Hello everyone!
I developped an application using web2py 1.99.xx some months ago, and I
passed it to web2py 2.2.1 in order to be up to date :-) (And I prefer the
new layout...) Thanks again for this beautiful version !
Nevertheless, I since encountered several strange problems
(request.vars['not existing key"] does not throws a KeyError anymore ; Row
does not inherit from dict ; a "tooltip" class is now defined by default
for Bootstrap...) but none of which was very difficult to solve.
But today, I stubled on something too complicated unless I missed something.
Here is the trace I have, which explains everything :
Traceback (most recent call last):
File
"C:\Users\cedric\projets\LACT\eclipse\Lactw221\web2py\gluon\restricted.py",
line 212, in restricted
exec ccode in environment
File
"C:/Users/cedric/projets/LACT/eclipse/Lactw221/web2py/applications/lact/controllers/evaluation.py"
<http://127.0.0.1:8000/admin/default/edit/lact/controllers/evaluation.py>,
line 657, in <module>
File "C:\Users\cedric\projets\LACT\eclipse\Lactw221\web2py\gluon\globals.py",
line 188, in <lambda>
self._caller = lambda f: f()
File "C:\Users\cedric\projets\LACT\eclipse\Lactw221\web2py\gluon\tools.py",
line 2911, in f
return action(*a, **b)
File
"C:/Users/cedric/projets/LACT/eclipse/Lactw221/web2py/applications/lact/controllers/evaluation.py"
<http://127.0.0.1:8000/admin/default/edit/lact/controllers/evaluation.py>,
line 189, in stop
_stop(userid)
File
"C:/Users/cedric/projets/LACT/eclipse/Lactw221/web2py/applications/lact/controllers/evaluation.py"
<http://127.0.0.1:8000/admin/default/edit/lact/controllers/evaluation.py>,
line 248, in _stop
return mode.on_end()
File
"C:/Users/cedric/projets/LACT/eclipse/Lactw221/web2py/applications/lact/models/a34_lact_running_modes.py"
<http://127.0.0.1:8000/admin/default/edit/lact/models/a34_lact_running_modes.py>,
line 43, in on_end
session.flash = T('Serie finished! Thank you!')
NameError: global name 'T' is not defined
As you see, a34_running_modes.py is in the 'models' folder. But a function
from it called from the controller doesn't know of 'T' which is global !
Previously I had the same error in some other functions with 'auth'
(defined in a12_db.py, so still before) and 'request', which I solved by
passing 'auth' or 'request' as function arguments (even if I find it not
very nice...), as they are available in the controller function.
But if even T is not known, I cannot pass all usual global variables as
arguments to every function present in 'models' folder.
Do I miss something ? Like a "what-to-check-if-you want-to-upgrade web2py"
documentation ? (even if I thought web2py was fully backward compatible,
this is why I choose it)
Thank you for your insights !
--