On 19 November 2012 15:53, Cédric Mayer <argla...@gmail.com> wrote: > > 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 > > de.on_end() > > 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) > > The problem might be the name of your model. If I remember correctly the models are imported in alphabetical order. In the default db.py (like in the welcome app) some important stuff gets imported that should happen before other models are loaded.
As an experiment try a changed name for your model which starts with a character > 'd'. Otherwise do import the necessary stuff from gluon in your model. e.g. from gluon import T Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) --