[mod_python] Storing functions in session ?

Gregory (Grisha) Trubetskoy grisha at modpython.org
Mon Mar 8 16:58:44 EST 2004

No, the things that you store in a session must be picklable.


On Mon, 8 Mar 2004, SAiello at Jentoo.com wrote:

> 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.
> _______________________________________________
> 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