[mod_python] Session problems

Nicolas Lehuen nicolas.lehuen at gmail.com
Tue Feb 15 09:43:08 EST 2005


Tu les achètes où et quand, les jeux ?

@+
Nico


On Tue, 15 Feb 2005 08:14:20 -0500, Wagner,Harry <wagnerh at oclc.org> wrote:
> 
> Take out sess.unlock(). There's no need to do this as it's handled by
> the class itself by default.  This could have perhaps lead to
> MemoryErrors.
> 
> ----
> Thanks Chris.  I removed the unlockm,, but still no luck.  The problem
> seems to be with the following statement:
> 
> sess['ddcSearch'] = ddcServer.ddcSearch
> 
> If I comment that statement out (and the following load for ddcSearch)
> then it works.  Otherwise it fails on the 'sess.save()' statement.
> ddcSearch is a fairly large and complex object.  Does this matter?  I'm
> running apache 2.0.40 and mod_python-3.1.3.
> 
> Thanks!  harry
> 
> 
> On Mon, 14 Feb 2005 17:11:07 -0500, Wagner,Harry <wagnerh at oclc.org>
> wrote:
> > I am trying to convert a program (see below) written for the
> > BaseHTTPServer to Apache and am getting a MemoryError trying to save
> > the session.  Is there a trick to this I am missing?  Thanks!  harry
> >
> > from mod_python import apache, util, Session import sys, urllib,
> > urlparse, xml.dom.pulldom, cgi, socket, xml.sax.saxutils, StringIO,
> > math, glob, os.path, ddc3
> >
> > def handler(req):
> >         sess = Session.Session(req)
> >         ddcServer = DDCServer(req)
> >         ddcServer.root = ddcServer.req.document_root()
> >         oclc2ddcFile = ddcServer.root + '/Collections/eBooks.ddc'
> >         recFileName = ddcServer.root +
> '/Collections/eBooks.ddc.ulines'
> >         compHoldingsFile = ddcServer.root + '/ihbnum.compressed'
> >         captionsFile = ddcServer.root + '/Captions'
> >         ddcServer.testing = 0
> >         if sess.is_new():
> >                 req.write("Session is new\n")
> >                 ddcServer.captions = DDCCaptions(captionsFile)
> >                 ddcServer.localText = TextLocalization(captionsFile)
> >                 ddcServer.ddcSearch =
> > ddc3.DDCSearch(file(oclc2ddcFile),
> > recFileName, file(compHoldingsFile, 'rb', 100000))
> >                 try:
> >                         sess['captions'] = ddcServer.captions
> >                         sess['localText'] = ddcServer.localText
> >                         sess['ddcSearch'] = ddcServer.ddcSearch
> >                         sess.save()
> >                         sess.unlock()
> >                         req.write("Session saved\n")
> >                 except MemoryError: req.write("MemoryError raised\n")
> >         elif not sess.is_new():
> >                 sess.load()
> >                 req.write("Previous session loaded\n")
> >                 ddcServer.captions = sess['captions']
> >                 ddcServer.localText = sess['localText']
> >                 ddcServer.ddcSearch = sess['ddcSearch']
> >                 req.write("data has finished loading\n")
> > #       ddcServer.do_GET()
> >         return apache.OK
> >
> > -------
> > Session is new
> > MemoryError raised
> >
> > _______________________________________________
> > 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