Hello, I tried using the code suggested. I get this error? I can see where it seems to be good code. Thanks for any help Error ticket for "med" Ticket 127.0.0.1.2009-08-02.11-43-36.b6521ed1- f325-42e3-9976-5671ab4c227e
Error traceback 1. 2. 3. 4. 5. 6. Traceback (most recent call last): File "gluon/restricted.py", line 178, in restricted File "C:/web2py_win(2)/web2py/applications/med/models/db.py", line 80, in <module> File "gluon/sql.py", line 995, in define_table SyntaxError: invalid table name: auth_user In file: C:\web2py_win(2)\web2py\applications\med/models/db.py 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. # coding: utf8 ######################################################################### ## This scaffolding model makes your app work on Google App Engine too ######################################################################### if request.env.web2py_runtime_gae: # if running on Google App Engine db = DAL('gae') # connect to Google BigTable session.connect(request, response, db=db) # and store sessions and tickets there ### or use the following lines to store sessions in Memcache # from gluon.contrib.memdb import MEMDB # from google.appengine.api.memcache import Client # session.connect(request, response, db=MEMDB(Client()) else: # else use a normal relational database db = DAL('sqlite://storage.sqlite') # if not, use SQLite or other DB ## if no need for session # session.forget() ######################################################################### ## Here is sample code if you need for ## - email capabilities ## - authentication (registration, login, logout, ... ) ## - authorization (role based authorization) ## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss) ## - crud actions ## comment/uncomment as needed from gluon.tools import * auth=Auth(globals(),db) # authentication/ authorization auth.define_tables() # creates all needed tables crud=Crud(globals(),db) # for CRUD helpers using auth service=Service(globals()) # for json, xml, jsonrpc, xmlrpc, amfrpc # crud.settings.auth=auth # enforces authorization on crud # mail=Mail() # mailer # mail.settings.server='smtp.gmail.com:587' # your SMTP server # mail.settings.sender='y...@gmail.com' # your email # mail.settings.login='username:password' # your credentials or None # auth.settings.mailer=mail # for user email verification # auth.settings.registration_requires_verification = True # auth.settings.registration_requires_approval = True # auth.messages.verify_email = \ # 'Click on the link http://.../user/verify_email/%(key)s to verify your email' ## more options discussed in gluon/tools.py ######################################################################### ######################################################################### ## Define your tables below, for example ## ## >>> db.define_table('mytable',Field('myfield','string')) ## ## Fields can be 'string','text','password','integer','double','boolean' ## 'date','time','datetime','blob','upload', 'reference TABLENAME' ## There is an implicit 'id integer autoincrement' field ## Consult manual for more options, validators, etc. ## ## More API examples for controllers: ## ## >>> db.mytable.insert(myfield='value') ## >>> rows=db(db.table.myfield=='value).select(db.mytable.ALL) ## >>> for row in rows: print row.id, row.myfield ######################################################################### db.define_table('specialty',SQLField('name')) from gluon.tools import * auth=Auth(globals(),db) # authentication/authorization # the fields below are requires you can add more auth.settings.table_user = db.define_table("auth_user", db.Field("first_name", length=128,default=""), db.Field("middle_name", length=128,default=""), db.Field("last_name", length=128,default=""), db.Field("email", length=128,default=""), db.Field("web_page", length=128,default=""), db.Field("is_patient", 'boolean', default=True), db.Field("is_doctor", 'boolean', default=True), db.Field("is_administrator", 'boolean', default=True), db.Field("password", "password",readable=False, label="Password"), db.Field("registration_key", length=128, writable=False, readable=False, default="")) t = auth.settings.table_user t.first_name.requires = IS_NOT_EMPTY() t.last_name.requires = IS_NOT_EMPTY() t.password.requires = CRYPT() # password will be stored hashed t.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db, db.auth_user.email)] t.web_page.requires=IS_URL() auth.define_tables() ### auth_user will not be redefined! db.define_table('doctor_speciatly', SQLField('doctor',db.auth_user), SQLField('specialty',db.specialty)) db.doctor_specialty.doctor.requires=IS_IN_DB(db (db.auth_user.is_doctor==True), db.auth_user.id,'%(first_name)s %(last_name)s') db.doctor_specialty.specialty.requires=IS_IN_DB(db, db.specialty.id,'%(name)s') db.define_table('prescription', SQLField('doctor',db.auth_user), SQLField('patient',db.auth_user), SQLField('drug_name',length=128), SQLField('prognosis','text')) db.prescription.doctor.requires=IS_IN_DB(db (db.auth_user.is_doctor==True), db.auth_user.id,'%(first_name)s %(last_name)s') db.prescription.patient.requires=IS_IN_DB(db (db.auth_user.is_patient==True), db.auth_user.id,'%(first_name)s %(last_name)s') --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---