Ah yes, as the book says:
and now all modules imported can access current.auth.
current and import create a powerful mechanism to build extensible and
reusable modules for your applications.
Beware! Given from gluon import current, it is correct to use
current.request and any of the other thread local objects but one should
never assign them to global variables in the module, such as in
request = current.request # WRONG! DANGER!
nor one should use it assign class attributes
class MyClass:
request = current.request # WRONG! DANGER!
This is because the thread local object must be extracted at runtime.
Global variables instead are defined only once when the model is imported
for the first time.
--
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.