Does web.config get the job done? It's a thread-safe web.storage
object that you can access app-wide.

On Sat, May 8, 2010 at 5:21 PM, bud <[email protected]> wrote:
> 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.
>
>



-- 
Branko Vukelić

[email protected]
[email protected]

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

-- 
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.

Reply via email to