[web2py] using web2py globals in modules

2011-10-13 Thread pepper_bg
Hi, I have some helper code in applications/myapp/modules/site_helpers.py. I've been trying to cache the results of some of the functions there. The current content is: from gluon.shell import exec_environment ee = exec_environment('applications/myapp/models/db.py') cache = ee.cache

Re: [web2py] using web2py globals in modules

2011-10-13 Thread Bruno Rocha
for use the global variables in modules the new recommended way is using current object. in models/***.py from gluon import current current.foo = bar in modules/***.py from gluon import * foo = current.foo # current already has session, request, response and T http://zerp.ly/rochacbruno Em