|
Wagner,Harry
wagnerh at oclc.org
Mon Feb 14 17:11:07 EST 2005
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
|