Gregory Trubetskoy
grisha at modpython.org
Mon Sep 11 08:16:37 EST 2000
The problem with that is subinterpreters. A single request can go through several subinterpreters, and if you end up with a dictionary created in one, but it has members created in another, you run a risk of some weird errors. If you stringify, then you can pass data across handlers as well as across subinterpreters with no ill sideffects. What I'd like to know is - how likely really is it that someone would be passing anything more complex than a couple of flags between handlers? (I can't think of a practical need for it, but then I haven't thought hard enough... ) Grisha On Fri, 8 Sep 2000, Rich Salz wrote: > The problem with notes, of course, is that stringifying is too limiting. > > Here's a suggestion. Add a new method: > req.get_state() > that returns a dictionary associated with this request, or None. > req.create_state() > creates the dictionary. > > The C code creates a PyDict object. Fiddle the refcounting so it doesn't get > cleaned up > until the request is done. How to attach it to the request_rec object? > Either "stringify" the pointer (using the ANSI-C %p format) or some kind of > hack. > > Hope this helps. > > Gregory Trubetskoy wrote: > > > > I think req->notes is the best for now. I'll think about some more > > elegant way for future versions. A global is not so good because you may > > accidently pass it to a different request alltogether, whereas notes is > > guaranteed to get cleaned between requests. > > > > Grisha > > > > On Fri, 8 Sep 2000, Rich Salz wrote: > > > > > What's the best way to create data in one handler (e.g., Authen) and > > > make it available to another? Create a global? Stringify and use the > > > notes attr? > > > > > > tnx. > > > _______________________________________________ > > > Mod_python mailing list > > > Mod_python at modpython.org > > > http://www.modpython.org/mailman/listinfo/mod_python > > > >
|