[mod_python] Session management

Chris Jackson christopher.jackson at gmail.com
Tue Jan 11 22:40:49 EST 2005


Yes, I store the information inside of session variable, but ti's the
session variable itself that dissapears and comes back.

~= Chris =~


On Tue, 11 Jan 2005 20:01:05 -0500, Chris Curvey <ccurvey at earthlink.net> wrote:
> Chris Jackson wrote:
> 
> >>Depending on what type of apache configuration you run, one or more
> >>interpreters will be used. Sometimes interpreters die and new ones get
> >>created.
> >>
> >>
> >
> >Hmm...it's interesting you say that somtimes the interpreters die and
> >new ones get created because I'm running into a "problem" where I will
> >test a mod_python page and it will works perfectly several times again
> >and again, but then i'll test it out again, and the interpreter seems
> >to "forget" the values.  I'll keep testing the page with the same
> >values, and then the page will work again.
> >
> >It's almost as if the interpreter had temporary amnesia, or was in the
> >process of dumping values from one interpreter into another
> >interpreter, which seems to happen more often than desired.
> >
> >Is anyone familiar with this behavior?
> >
> >
> Yes, that's the hallmark of getting a different interpreter.  If you
> need to hold "state" information, you need to store it somewhere else
> (like in the session, or on the filesystem, or in a database).  In other
> words, this would be the WRONG way to do things
> 
> class Foo:
>     def doFirstThing(self):
>         self.firstThingDone = true
> 
>     def doSecondThing(self):
>         if not self.firstThingDone:
>             raise Exception
>         else:
>              # do real work
> 
> Because when the call comes in to doSecondThing(), you can't count on
> getting the same instance of Foo that you got when you called
> doFirstThing().
> 
> >_______________________________________________
> >Mod_python mailing list
> >Mod_python at modpython.org
> >http://mailman.modpython.org/mailman/listinfo/mod_python
> >
> >
> >
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list