[mod_python] how do i share variables accross requests?

Tobiah toby at rcsreg.com
Fri Aug 27 06:18:30 EDT 2004


> Do i really have to pickle what i want to share and write it on disk 
> using dbm, mysql or such? Wouldn't this be terribly inefficient, 
> pickiling and unpickling every request?

This is exactly what I decided to do.  I made a simple mysql database
called 'session' that will handle all of the session data for all of
the web apps for my company.  I tag each session with an 'appname' so
that each report or app can register its own discreet session for
each user.  This is very important if, like around here, a person might
have several apps open at once.  It used to be that one app would
destroy a persons session from another app.

I don't think that efficiency will be a problem.  Every web application
that I have ever written already connects to and queries from a
database on every page hit.  One more little request to retrieve a
small session object shouldn't be of any concern.  PHP uses temp files
to do the same thing.

By writing this myself I think that I will afford myself the greatest
flexibility in the future.

Tobiah


More information about the Mod_python mailing list