Hello,
I believe this must be an FAQ, but I just couldn't find an answer to
it.
I would like to set up some application-wide resources (environment
variables) and am looking for a way to access them from GET and POST
methods.
I set up my application as web.application(urls, globals()), so I
managed to get by, defining all my environment variables in a module
that I import also from the module that defines the GET and POST
methods. This works but isn't very elegant..
I would like to pass the enviornment to web.application somehow. I
tried the following without success:
import web
urls = ('/', 'hello')
def webApp(myEnv):
ns = globals()
ns.update(myEnv)
print ns['myVar']
app = web.application(urls, ns)
return app
class hello:
def GET(self):
return 'hello %s' % myVar
if __name__ == "__main__":
wa = webApp({'myVar':'there'})
wa.run()
Can anyone tell me how to get the job done?
Many thanks in advance!
-bud
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.