[Zope] Session Variables disappear

Dennis Allison allison at sumeru.stanford.EDU
Thu May 20 15:36:45 EDT 2004


Session variables have a settable lifetime.  I use 2000 minutes as the
default and then clear them out when my users close the session (if they
remember to do so).

The problem has to do with *reading* session variable values usually
through a Python Script which does very little but return 

	container.REQUEST['SESSION'][session_var_name]

where the session_var_name is passed in.  This is a very very common
operation that usually works flawlessly.  But once in a while it fails
with a KeyError

Traceback (innermost last):
  File /lulu/zope/software_home/lib/python/ZPublisher/Publish.py, line 98,
in publish
  File /lulu/zope/software_home/lib/python/ZPublisher/mapply.py, line 88,
in mapply
    (Object: home_html)
  File /lulu/zope/software_home/lib/python/ZPublisher/Publish.py, line 39,
in call_object
    (Object: home_html)
  File /lulu/zope/software_home/lib/python/OFS/DTMLMethod.py, line 126, in
__call__
    (Object: home_html)
  File /lulu/zope/software_home/lib/python/DocumentTemplate/DT_String.py,
line 474, in __call__
    (Object: home_html)
  File /home/zopesys/lib/python/DocumentTemplate/DT_Let.py, line 75, in
render
    (Object:
topic_ident="queries.query_topic_ident(top_id=topic).tuples()[0][0]"
          course_name="getSessionVariable('currentCourse')"

viewpath="scripts.makeHTMLfilename(course_name,topic_ident,component,sequence)")
  File /lulu/zope/software_home/lib/python/DocumentTemplate/DT_Util.py,
line 201, in eval
    (Object: getSessionVariable('currentCourse'))
    (Info: getSessionVariable)
  File <string>, line 2, in f
  File /lulu/zope/software_home/lib/python/Shared/DC/Scripts/Bindings.py,
line 252, in __call__
    (Object: getSessionVariable)
  File /lulu/zope/software_home/lib/python/Shared/DC/Scripts/Bindings.py,
line 283, in _bindAndExec
    (Object: getSessionVariable)
  File
/lulu/zope/software_home/lib/python/Products/PythonScripts/PythonScript.py,
line 314, in _exec
    (Object: getSessionVariable)
  File Script (Python), line 3, in getSessionVariable
  File /lulu/zope/software_home/lib/python/AccessControl/ZopeGuards.py,
line 90, in guarded_getitem
  File
/lulu/zope/software_home/lib/python/Products/Transience/TransientObject.py,
line 170, in __getitem__
KeyError: currentCourse

I am loath to upgrade at the moment because I do not want to destabalize
the sytem.  I was under the impression that 2.6.4 was still stabalizing
following the many changes due to the security review.  Several of the
products we use have not been ported to 2.7 as of yet and we don't have
the cycles to do the ports ourselves at the moment.



On Thu, 20 May 2004, Andreas Jung wrote:

> 
> 
> --On Donnerstag, 20. Mai 2004 10:44 Uhr -0700 Dennis Allison 
> <allison at sumeru.stanford.EDU> wrote:
> 
> >
> > Zope 2.6.2b3, Py 2.1.3, Linux
> ^^^^^^^^^^^^^^
> Extremely old...upgrade at least to the latest 2.6.X version or even better 
> 2.7
> 
> >
> > We use session variables everywhere and have a fairly large number of
> > concurrent sessions.  Every so often the session variables go away and
> > the whole house of cards collapses becasuse nearly everything depends upon
> > session variables.
> 
> What do you mean by "go away". Session have a limited lifetime (20 minutes 
> by default).
> 
> -aj
> 




More information about the Zope mailing list