Thanks, Anthony. That works. On Wednesday, 14 February 2018 08:47:57 UTC-7, Anthony wrote: > > Good catch. The problem is the new default version of db.py creates a > "configuration" object, which is subsequently referenced in the menu.py > model file. > > Anyway, there is no need to completely replace the contents of db.py -- > just add the content shown, except you don't need the db = DAL(...) line. > > Anthony > > On Wednesday, February 14, 2018 at 10:16:11 AM UTC-5, Bryan Nahrwold wrote: >> >> I have downloaded Web2Py version >> 2.16.1-stable+timestamp.2017.11.14.05.54.25 >> >> I am working my way through the manual in section *3.3 An image blog*. >> >> The manual specifies to create the images project and replace *ALL* >> content in db.py with: >> >> db = DAL("sqlite://storage.sqlite") >> >> db.define_table('image', >> Field('title', unique=True), >> Field('file', 'upload'), >> format = '%(title)s') >> >> db.define_table('post', >> Field('image_id', 'reference image'), >> Field('author'), >> Field('email'), >> Field('body', 'text')) >> >> db.image.title.requires = IS_NOT_IN_DB(db, db.image.title) >> db.post.image_id.requires = IS_IN_DB(db, db.image.id, '%(title)s') >> db.post.author.requires = IS_NOT_EMPTY()t say to do anything but replace >> db.post.email.requires = IS_EMAIL() >> db.post.body.requires = IS_NOT_EMPTY() >> >> db.post.image_id.writeable = db.post.image_id.readable = False >> >> Until I make this change I can click on the Database Administration link >> for this app and go to the listing of database files for this application. >> Once I make this change and click the Database Administration link, I get >> :the ticket with the error listing below. Now I have tied both copying the >> new db.py content and typing it in, multiple times. The manual does not say >> to do anything but replace the text, save, and then click the images >> application data base administration link. It always errors with: >> >> web2py™ administrative interface >> <http://127.0.0.1:8000/admin/default/index> >> >> - Site <http://127.0.0.1:8000/admin/default/site> >> - Edit <http://127.0.0.1:8000/admin/default/design/images> >> - About <http://127.0.0.1:8000/admin/default/about/images> >> - Errors <http://127.0.0.1:8000/admin/default/errors/images> >> - Versioning <http://127.0.0.1:8000/admin/mercurial/commit/images> >> - Help <http://127.0.0.1:8000/examples/default/documentation> >> - Logout <http://127.0.0.1:8000/admin/default/logout> >> - Debug <http://127.0.0.1:8000/admin/debug/interact> >> >> Error ticket for "images" Ticket ID >> >> 127.0.0.1.2018-02-13.15-53-20.c0e98cc5-8b46-4b1b-af35-538c69d19a9f >> <type 'exceptions.NameError'> name 'configuration' is not defined Version >> web2py™ Version 2.16.1-stable+timestamp.2017.11.14.05.54.25 >> Python Python 2.7.9: C:\web2py_win\web2py\web2py.exe (prefix: ) Traceback >> >> 1. >> 2. >> 3. >> 4. >> 5. >> 6. >> 7. >> >> Traceback (most recent call last): >> File "C:\web2py_win\web2py\gluon\restricted.py", line 219, in restricted >> exec(ccode, environment) >> File "C:/web2py_win/web2py/applications/images/models/menu.py" >> <http://127.0.0.1:8000/admin/default/edit/images/models/menu.py>, line 16, >> in <module> >> if not configuration.get('app.production'): >> NameError: name 'configuration' is not defined >> >> Error snapshot [image: help] >> <http://127.0.0.1:8000/admin/default/ticket/images/127.0.0.1.2018-02-13.15-53-20.c0e98cc5-8b46-4b1b-af35-538c69d19a9f#> >> >> >> <type 'exceptions.NameError'>(name 'configuration' is not defined) >> >> inspect attributes >> Frames >> >> - >> >> File C:\web2py_win\web2py\gluon\restricted.py in restricted at line >> 219 code arguments variables >> - >> >> File C:\web2py_win\web2py\applications\images\models\menu.py in >> <module> at line 16 code arguments variables >> Function argument list >> >> () >> Code listing >> >> 11. >> 12. >> 13. >> 14. >> 15. >> 16. >> >> 17. >> 18. >> 19. >> 20. >> >> >> # >> ---------------------------------------------------------------------------------------------------------------------- >> # provide shortcuts for development. you can remove everything below in >> production >> # >> ---------------------------------------------------------------------------------------------------------------------- >> >> if not configuration.get('app.production'): >> >> _app = request.application >> response.menu += [ >> (T('My Sites'), False, URL('admin', 'default', 'site')), >> (T('This App'), False, '#', [ >> >> Variables >> configuration undefined >> >> Context >> >> locals request session response >> In file: C:\web2py_win\web2py\applications\images\models\menu.py >> >> 1. >> >> <code object <module> at 03B9D890, file >> "C:\web2py_win\web2py\applications\images\models\menu.py", line 9> >> >> Powered by web2py <http://www.web2py.com/>™ created by Massimo Di Pierro >> ©2007-2018 - Admin language Afrikaanse Български čeština Deutsch English >> (US) English (US) Español Français עברית Italiano 日本語 မြန်မာ Nederlands >> Polska Português Português Brasileiro Română Русский Slovenski Српски >> (Ћирилица) Srpski (Latinica) Türkçe Українська 中文 台灣中文 >> >
-- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.