BaseHTTPServer and class variables

Yin yin_12180 at yahoo.com
Mon Jan 26 11:25:00 EST 2004


Hello.

I am using the basehttpserver to implement the HTTP protocol to serve
a fairly large lexicon that I have loaded as a dictionary in python. 
Rather than writing a whole server, I would like to reuse the
BaseHTTPserver classes. I am interested in finding a way to serve the
dict without loading the whole dict into memory everytime an HTTP
request is made. The dict lives in local memory when it is loaded and
takes a long time to load.

Unfortunately with the basehttpserver.httpserver and
basehttpserver.requesthandlerclass, I am not finding it easy to define
a method to load the dict initially.  Any thoughts are appreciated.

Ideally, in a do_GET for the requesthandlerclass, it'd be nice to be
able to access the dict as a class variable, but this doesn't work for
me.

Thanks.
Yin



More information about the Python-list mailing list