[mod_python] Lost Session

Jeremy Kohansimeh jkohans at gmail.com
Mon Jun 20 13:11:09 EDT 2005


Here is the part of the code that handles the response (after some 
intermediate data processing):

def genAllChromsHTML( req):

pbean = req.pbean
sess = req.sess

vars = { 'image' : os.path.join( '../../images', sess[ 'image']),
'map_file' : os.path.join( '../../images', sess[ 'map_file']) }

sess.save()

return psp.PSP( req, filename=ALL_CHROMS_TMPL, vars=vars)

Here is the PSP code for the template file:

<html>
<body>
<center><a target="_new" href="<%= map_file %>"> <img src="<%= image %>" 
ismap></a></center>
</body>
</html>

I've been able to establish that the session object does contain the 
dictionary elements that I expect at this point in the code. Here are the 
dictionary keys in case they conflict with anything that might affect saving 
the session:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
map_file
image
num_of_lines
data_file
1800

Thanks for any help.

Jeremy

On 6/20/05, Joshua Ginsberg <listspam at flowtheory.net> wrote:
> 
> No, there's not really a problem in the save function... and the
> limitations of your data store are defined by the type of session.
> Memory session limits are how much memory you have; DBM session limits
> are how much disk you have. :-) If you'd like to post more code, I'd be 
> happy to help triage, however absent more information, there's not a
> lot of help I can offer.
> 
> -jag
> 
> 
> 
> 
> Joshua Ginsberg -- joshg at brainstorminternet.net 
> Brainstorm Internet Network Operations
> 970-247-1442 x131
> On Jun 20, 2005, at 10:07 AM, Jeremy Kohansimeh wrote:
> 
> > I do make this call after I have filled the session with data. I
> > didn't post that part of the code bc I've already established that the 
> > problem is not there. Unless, there is a problem with the save
> > function--is there an artificial limit on the amount of data that can
> > be stored into a session, or is it limited by the size of the disk? 
> >
> > Jeremy
> >
> > On 6/20/05, Joshua Ginsberg <listspam at flowtheory.net> wrote:
> >>
> >> -jag
> >>
> >>
> >>
> >>
> >> Joshua Ginsberg -- joshg at brainstorminternet.net
> >> Brainstorm Internet Network Operations
> >> 970-247-1442 x131
> >> On Jun 20, 2005, at 9:21 AM, Jeremy Kohansimeh wrote: 
> >>
> >> > Hello,
> >> >
> >> >I am having trouble recovering a session. On the initial request, I
> >> > create some entries for the session and then save it (I have
> >> confirmed 
> >> > that there is data in the session before I save it and that the
> >> save()
> >> > function is being called). On subsequent requests, the session
> >> object
> >> > that I have created is not reinstated, instead a new one is created 
> >> (I
> >> > have coonfirmed this with the is_new() function). I have checked my
> >> > browser and there is a pysid cookie being set on the first request.
> >> > Does anyone have any tips to debug this? I am really at a loss for 
> >> > what is going on.
> >> >
> >> >Here is the code that I use to reinstate/create a session:
> >> >
> >> >def handler(req, **kw):
> >> > """handles initial requests""" 
> >> >
> >> > f = open( LOGFILE, 'a+')
> >> >
> >> > req.sess = Session.Session( req)
> >> >
> >> > if not req.sess.is_new():
> >> > # this is an old session, so load it up 
> >> > req.sess.load()
> >> > f.write( 'old session\n')
> >> > else:
> >> > f.write( 'new session\n')
> >> >
> >> > f.close ()
> >> >
> >> > return segment.dispatchToHandler( req)
> >> >
> >> >Best Regards,
> >> >Jeremy Kohansimeh
> >> > _______________________________________________
> >> > 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
> 
> 
> 
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20050620/d9134e2a/attachment.html


More information about the Mod_python mailing list