[mod_python] Storing functions in session ?

SAiello at Jentoo.com SAiello at Jentoo.com
Mon Mar 8 13:54:06 EST 2004


I was wondering if it is possible to store functions within the session. I am 
playing around with writing a Python web IMAP client. I have been using the 
imaplib.IMAP4 library. The reason I ask, is once I create a connection to the 
IMAP server, I would like to keep it for any other commands. Thus I do not 
have to keep logging in, everytime I need to run an IMAP command.

What I have done is:
imapSess=imaplib.IMAP4('server.com')
imapSess.login(sess['imapUser'], sess['imapPass'])
sess['IMAP']=imapSess
sess.save()

When I do this I get:
TypeError: a class that defines __slots__ without defining __getstate__ cannot 
be pickled

I am still rather new to python, so I figure I am trying to do something 
stupid.

Thanks.



More information about the Mod_python mailing list