[mod_python] Storing functions in session ?

SAiello at Jentoo.com SAiello at Jentoo.com
Mon Mar 8 14:34:31 EST 2004


Well storing the function seemed kinda wrong. I just do not know if there is 
any way to open a connection, and leave that connection open for use later 
on. Not to sure on the jargon, almost like pooling connections to a database.  
Only problem is each connection is for a particular user, and you would never 
want them to get mixed up, otherwise someone would be reading someone else's 
email. Any ideas or suggestions are welcomed. 

On Monday 08 March 2004 02:13 pm, Erik Stephens wrote:
> 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.
>
> Pickling something like a connection to a server seems odd.  Not sure
> it's really possible the way you describe it.  You could pickle all of
> the connection information but not the connection itself.  By
> connection, I'm referring to the underlying network connection, not
> the Python object that is abstracting that.  You could maybe get that
> IMAP4 instance to pickle by overriding some hooks or something, but to
> avoid dangling connections you would want to disconnect from the
> server when pickling and re-connect when unpickling which doesn't seem
> what you are striving for.
>
> Note: this is kinda off the top of my head about what I know about
> pickling/serialization in general, which I'm assuming is part of the
> session handling interface and which I'm no expert :)
>
>
> Best regards,
> Erik
>
> _______________________________________________
> 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