OK In trunk now, more explicit error from shell. No more restrctederrors. Massimo
On May 13, 2:47 am, AchipA <attila.cs...@gmail.com> wrote: > Also, this is probably worth an alterego note or wiki entry as it's a > bit of a gotcha, I'm just not sure how to classify it... > > On May 13, 2:40 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > We need to decide when to stop. This and the one before are not bugs. > > > request.env stores environment variables passed to the app by the web > > server. > > > when running a script with -M -S the models are executed but (by > > definition) there is no web server so these variables do not exist. > > When a model needs access to request.env variables it simply cannot be > > accessed as a script or via the shelll. There is nothing to fix but > > there are ways around it: > > > - pretend there is always a request.env (but what should be the > > default values?) > > - modify the models so that they check whether request.env is there > > and act accordingly (I'd prefer this so every app can choose its own > > behavior). > > > You tell me that with the default web2py apps, only admin has this > > problem but admin is not meant to be accessed with -M since it does > > not have a database at all. > > > Massimo > > > On May 12, 6:47 pm, AchipA <attila.cs...@gmail.com> wrote: > > > > Close, but not quite. Examples is OK, admin still chokes. > > > > Traceback (most recent call last): > > > File "/usr/src/web2py_bzr_cron/gluon/restricted.py", line 107, in > > > restricted > > > exec ccode in environment > > > File "applications/admin/models/access.py", line 34, in <module> > > > port = int(request.env.server_port) > > > TypeError: int() argument must be a string or a number, not 'NoneType' > > > > On May 12, 5:00 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > fixed in trunk. Please try it and let me know if it is ok. > > > > > On May 12, 6:47 am, AchipA <attila.cs...@gmail.com> wrote: > > > > > > There seems to be the problem when trying to invoke shells with models > > > > > (checked with latest from launchpad). For example, admin and examples > > > > > both fail miserably, welcome works. The actual error seems to be > > > > > referencing things like request.env in some of the models. This > > > > > behaviour also happens to break cron, so it kind of makes me itchy > > > > > even if we correct it manually in the default apps. Am I the only one > > > > > with this problem ? Any recommendations how to go around this ? > > > > > > python web2py.py -a 12345 -D 0 -S admin -M > > > > > default applications appear to be installed already > > > > > web2py Enterprise Web Framework > > > > > Created by Massimo Di Pierro, Copyright 2007-2009 > > > > > Version 1.62 rc2 (2009-05-11 23:25:54) > > > > > Python 2.5.2 on Linux-2.6.24-24-generic-x86_64-with-debian-lenny-sid > > > > > Database drivers available: SQLite3, MySQL > > > > > Traceback (most recent call last): > > > > > File "web2py.py", line 21, in <module> > > > > > start() > > > > > File "/usr/src/web2py_bzr/gluon/widget.py", line 748, in start > > > > > import_models=options.import_models, startfile=options.run) > > > > > File "/usr/src/web2py_bzr/gluon/shell.py", line 143, in run > > > > > _env = env(a, c=c, import_models=import_models) > > > > > File "/usr/src/web2py_bzr/gluon/shell.py", line 101, in env > > > > > run_models_in(environment) > > > > > File "/usr/src/web2py_bzr/gluon/compileapp.py", line 206, in > > > > > run_models_in > > > > > restricted(code, environment, layer) > > > > > File "/usr/src/web2py_bzr/gluon/restricted.py", line 115, in > > > > > restricted > > > > > raise RestrictedError(layer, code, '', environment) > > > > > gluon.restricted.RestrictedError: <gluon.restricted.RestrictedError > > > > > instance at 0x1414440> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" 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 -~----------~----~----~----~------~----~------~--~---