[mod_python] Sessions: Confused: Newbie

MCL Systems mcl.office at googlemail.com
Mon Feb 4 09:37:55 EST 2008


Elias,

Thanks for replying.

I am on a hosted system and the only two log files I have access to are:

.nfs..............
access_log............

I have looked at these and can not see any obvious errors.

Errors I made in the original script were recorded eg isnew() does not
exist, when I should have used is_new()

A thought that crossed my mind, is do I have to specify a timeout, as I had
assumed there would be some default value of 60 mins ?

Richard


On 04/02/2008, elias.collas at gulfstream.com <elias.collas at gulfstream.com>
wrote:
>
> Hi,
> I ran into this when I first started messing about with sessions.
> Check your apache error_log for session related exceptions. If sessions
> aren't properly configured, mod_python may not be able to create or
> retrieve the session id.
>
> HTH,
> Elias
>
> mod_python-bounces at modpython.org wrote on 02/04/2008 08:19:21 AM:
>
> > I thought I was understanding sessions but the following did not
> > work as I expected.
> >
> > I was expecting the first execution to create a session with a PID
> > of 666 and a Hits Value of 1 and on each refresh of that page in the
> > same browser to increment the hit counter, but the 'is_new' test,
> > returns true every time.  I have tried this on several computers and
> > with different browsers, but always the same result.
> >
> > Where have I gone wrong ?
> >
> > Richard
> >
> > MOD_PYTHON, Apache, PYTHON 2.5
> >
> > Code =====================================
> > from mod_python import Session, util
> >
> > def index(req):
> >     main(req)
> >
> > def main(req):
> >     mySess = Session.Session(req)
> >     if mySess.is_new():
> >         pid = 666
> >         mySess['pid'] = str(pid)
> >         mySess['hits'] = 1
> >         req.write("NEW Session PID: %s <BR>\n" % mySess['pid'])
> >         req.write("Hits: %s <br>\n" % mySess['hits'])
> >     else:
> >         mySess['hits'] +=1
> >         req.write("OLD Session PID: %s <BR>\n" % mySess['pid'])
> >         req.write("Hits: %s <br>\n" % mySess['hits'])
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org
> > http://mailman.modpython.org/mailman/listinfo/mod_python
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20080204/99731e76/attachment.html


More information about the Mod_python mailing list