I note that the proposed (real soon now...) thread-local storage for request "globals" would support stuff like this.
The idea is that there will be a request-specific (thread-local) object, accessible to gluon modules as well as application code. Its intended use is to give gluon modules access to the standard application-global items, like request and response, for general utility and to allow the use of T(), or a gluon variant thereof, in gluon modules.
However, there's no reason that it couldn't be used for other purposes as well. The app would have to be aware of it, and store a copy of its DEBUG (for example) in the object. We might want to give the object a Storage variable named something like app_settings, to avoid namespace conflict.
What do you think, Massimo? Are we ready for some thread-local logic? We can start slowly...
I just want to make sure everybody is aware that by doing this we give
up the possibility of using async servers and for me that ok (they
already have problems with connections pooliing as it is).
Flask has the same issue.
Massimo
> --
> mail from:GoogleGroups "web2py-developers" mailing list
> make speech: web2py-d...@googlegroups.com
> unsubscribe: web2py-develop...@googlegroups.com
> details : http://groups.google.com/group/web2py-developers
> the project: http://code.google.com/p/web2py/
> official : http://www.web2py.com/
I am ready!I just want to make sure everybody is aware that by doing this we give
up the possibility of using async servers and for me that ok (they
already have problems with connections pooliing as it is).
--
mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
Sorry to revive this topic, but I remember sometime ago until the last stable, there was an auto reload of the modules, using this new way of importing, how can enabled this again?.
--
mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
2011/6/17 Martín Mulone <mulone...@gmail.com>
Sorry to revive this topic, but I remember sometime ago until the last stable, there was an auto reload of the modules, using this new way of importing, how can enabled this again?.
Hi Martin,
I changed the api to something I believe was more convenient. If you look in gulon/custom_import.py you find two methods for this task:
def is_tracking_changes():
...
def track_changes(track=True):
...
So you'll have to call track_changes somewhere in your code to start the tracking. is_tracking_changes gives the current tracking state. So add:
from gluon.custom_import import track_changes
track_changes()
2011/6/17 Anthony <abas...@gmail.com>
On Friday, June 17, 2011 9:41:33 AM UTC-4, Pierre Thibault wrote:
2011/6/17 Martín Mulone <mulo...@gmail.com>
Sorry to revive this topic, but I remember sometime ago until the last stable, there was an auto reload of the modules, using this new way of importing, how can enabled this again?.
Hi Martin,
I changed the api to something I believe was more convenient. If you look in gulon/custom_import.py you find two methods for this task:
def is_tracking_changes():
...
def track_changes(track=True):
...
So you'll have to call track_changes somewhere in your code to start the tracking. is_tracking_changes gives the current tracking state. So add:
from gluon.custom_import import track_changes
track_changes()
So, as soon as you do track_changes(), all imports will automatically be reloaded if changed, or is there an additional step?Thanks.
No. It affects all applications. It will reload the module if the file has changed after the call to track_changes.
I'm confused. This is to get reload=True functionality in modules? It looks like that needs to go in the module itself? Is there any way to set it more globally like "if is_dev(): track_changes()"?Is it track_changes() or track_changes(track=True)?
--
Is track_changes() roughly equivalent to local_import()'s "reload=True" argument?
Do I put track_changes() in my module or somewhere else?
--
mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/