Kevin Dangoor wrote: > On Jun 20, 2006, at 5:19 AM, sastan wrote: > > > My problem is now: > > When two or more request coming in at same time, the later will > > overwrite the enviroment for the first. Is it possible to store the > > enviroment in a per thread way or do you have other suggestions? > > The easiest thing to do is to put it on the request object: > > cherrypy.request.kticket = ... > cherrypy.request.afs_token = ... >
If you want the environment to span multiple requests however, there is a cherrypy.thread_data object per thread. You can add functions to cherrypy.server.on_start_thread_list to have it executed on thread creation, likewise to cherrypy.server.on_stop_thread_list to execute on thread termination. I use these to hold my database handles so that I have a per thread connection to sqlite (which until recently wasn't thread safe). --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears -~----------~----~----~----~------~----~------~--~---

