[mod_python] persistent values

Dustin Mitchell dustin at ywlcs.org
Sun Jun 22 19:20:13 EST 2003

On Mon, Jun 23, 2003 at 10:12:22AM +1000, Gregory Bond wrote:
> > Suggestions of which part of the documentation to re-read?
> You need persistent session information.  Check the FAQ 3.8
> 	http://www.modpython.org/FAQ/faqw.py?req=show&file=faq03.008.htp

If I understood the question correctly, Mr. Bond needed to know how to keep
information from one handler to another in the same request.  If that ws
indeed what he meant, then the solution is to attach the information to the
request, e.g.

  req.cp = my_config_parser
  config_parser = req.cp

works like a charm.  Just be careful not to create a reference loop (e.g.,
don't let the config parser have a reference to req buried inside of it..).
This has caused memory leakage for me in the past.



  Dustin Mitchell
  dustin at ywlcs.org/djmitche at alumni.uchicago.edu

More information about the Mod_python mailing list