[mod_python] Passing data across handlers

Rich Salz rsalz at caveosystems.com
Fri Sep 8 22:41:27 EST 2000


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



More information about the Mod_python mailing list