this is a major bug introduced in 1.87.2. Will post 1.87.3 today.
On Oct 13, 6:21 am, Omri <omri...@gmail.com> wrote: > I came here to report this bug as well. > I did a workaround - it comes from the beginning of the appadmin.py > file. > For the meantime I put the if DEMO_MODE: inside a try..except block. > I'm not sure this is robust but at least it works: > > try: > if DEMO_MODE: > response.flash = T('disabled in demo mode') > redirect(URL('default','site')) > except: > pass > > hope this helps, > Omri > > On Oct 13, 11:50 am, DenesL <denes1...@yahoo.ca> wrote: > > > Same problem here. > > Create new app, click on "database administration" link, error. > > > On Oct 13, 2:43 am, Joe J <joe.jasin...@gmail.com> wrote: > > > > Hi all, > > > I have a newly updated web2py install. If I create a new > > > application and click on any controller associated with the > > > appadmin.py, I get a DEMO_MODE is not defined error. This is before > > > doing any sort of coding. Am I missing some sort of configuration > > > setting? > > > Any help is much appreciated. > > > Joe > > > > Version web2py Version 1.87.2 (2010-10-12 15:23:17) > > > > Error traceback > > > > 1. > > > 2. > > > 3. > > > 4. > > > 5. > > > 6. > > > 7. > > > > Traceback (most recent call last): > > > File "/Users/jjasinsk/Sites/web2py/web2py/gluon/restricted.py", line > > > 188, in restricted > > > exec ccode in environment > > > File "/Users/jjasinsk/Sites/web2py/web2py/applications/asdf/ > > > controllers/appadmin.py", line 14, in <module> > > > if DEMO_MODE: > > > NameError: name 'DEMO_MODE' is not defined > > > > Error snapshot > > > Detailed traceback description > > > > * Exception: <type 'exceptions.NameError'>(name 'DEMO_MODE' is not > > > defined) > > > Exception instance attributes > > > o __setattr__: <method-wrapper '__setattr__' of > > > exceptions.NameError object at 0x10160cc68> > > > o __reduce_ex__: <built-in method __reduce_ex__ of > > > exceptions.NameError object at 0x10160cc68> > > > o __getslice__: <method-wrapper '__getslice__' of > > > exceptions.NameError object at 0x10160cc68> > > > o __getitem__: <method-wrapper '__getitem__' of > > > exceptions.NameError object at 0x10160cc68> > > > o __setstate__: <built-in method __setstate__ of > > > exceptions.NameError object at 0x10160cc68> > > > o __getattribute__: <method-wrapper '__getattribute__' of > > > exceptions.NameError object at 0x10160cc68> > > > o __str__: <method-wrapper '__str__' of exceptions.NameError > > > object at 0x10160cc68> > > > o args: ("name 'DEMO_MODE' is not defined",) > > > o __reduce__: <built-in method __reduce__ of > > > exceptions.NameError object at 0x10160cc68> > > > o __format__: <built-in method __format__ of > > > exceptions.NameError object at 0x10160cc68> > > > o __class__: <type 'exceptions.NameError'> > > > o __dict__: {} > > > o __delattr__: <method-wrapper '__delattr__' of > > > exceptions.NameError object at 0x10160cc68> > > > o __subclasshook__: <built-in method __subclasshook__ of > > > type object at 0x10011b640> > > > o __repr__: <method-wrapper '__repr__' of > > > exceptions.NameError object at 0x10160cc68> > > > o __init__: <method-wrapper '__init__' of > > > exceptions.NameError object at 0x10160cc68> > > > o __hash__: <method-wrapper '__hash__' of > > > exceptions.NameError object at 0x10160cc68> > > > o __sizeof__: <built-in method __sizeof__ of > > > exceptions.NameError object at 0x10160cc68> > > > o __doc__: 'Name not found globally.' > > > o __unicode__: <built-in method __unicode__ of > > > exceptions.NameError object at 0x10160cc68> > > > o __new__: <built-in method __new__ of type object at > > > 0x10011b640> > > > * Python 2.6.1: /opt/local/bin/python > > > > File /Users/jjasinsk/Sites/web2py/web2py/gluon/restricted.py in > > > restricted at line 188 > > > [ code | arguments | variables ] > > > Function argument list: (code='# -*- coding: utf-8 -*-\n\n# > > > #####################...k=disk)\n\n > > > \nresponse._vars=response._caller(index)\n', environment={'A': <class > > > 'gluon.html.A'>, 'Auth': <class 'gluon.tools.Auth'>, 'B': <class > > > 'gluon.html.B'>, 'BEAUTIFY': <class 'gluon.html.BEAUTIFY'>, 'BODY': > > > <class 'gluon.html.BODY'>, 'BR': <class 'gluon.html.BR'>, 'CENTER': > > > <class 'gluon.html.CENTER'>, 'CLEANUP': <class > > > 'gluon.validators.CLEANUP'>, 'CODE': <class 'gluon.html.CODE'>, > > > 'CRYPT': <class 'gluon.validators.CRYPT'>, ...}, layer='/Users/ > > > jjasinsk/Sites/web2py/web2py/applications/asdf/controllers/ > > > appadmin.py') > > > > 183. > > > 184. > > > 185. > > > 186. > > > 187. > > > 188. > > > > 189. > > > 190. > > > 191. > > > 192. > > > > if type(code) == types.CodeType: > > > ccode = code > > > else: > > > ccode = compile2(code,layer) > > > > exec ccode in environment > > > > except HTTP: > > > raise > > > except Exception: > > > # XXX Show exception in Wing IDE if running in debugger > > > > * environment: {'A': <class 'gluon.html.A'>, 'Auth': <class > > > 'gluon.tools.Auth'>, 'B': <class 'gluon.html.B'>, 'BEAUTIFY': <class > > > 'gluon.html.BEAUTIFY'>, 'BODY': <class 'gluon.html.BODY'>, 'BR': > > > <class 'gluon.html.BR'>, 'CENTER': <class 'gluon.html.CENTER'>, > > > 'CLEANUP': <class 'gluon.validators.CLEANUP'>, 'CODE': <class > > > 'gluon.html.CODE'>, 'CRYPT': <class 'gluon.validators.CRYPT'>, ...} > > > * ccode: <code object <module> at 0x10138d300, file "/ > > > Use...plications/asdf/controllers/appadmin.py", line 7> > > > > File /Users/jjasinsk/Sites/web2py/web2py/applications/asdf/controllers/ > > > appadmin.py in <module> at line 14 > > > [ code | arguments | variables ] > > > Function argument list: () > > > > 9. > > > 10. > > > 11. > > > 12. > > > 13. > > > 14. > > > > 15. > > > 16. > > > 17. > > > 18. > > > > import datetime > > > import copy > > > import gluon.contenttype > > > import gluon.fileutils > > > > if DEMO_MODE: > > > > response.flash = T('disabled in demo mode') > > > redirect(URL('default','site')) > > > > # ## critical --- make a copy of the environment > > > > * DEMO_MODE: undefined > >