durusmail: quixote-users: Session persistence for Quixote 2.0
Session persistence for Quixote 2.0
2005-05-26
2005-05-27
2005-05-27
2005-05-27
2005-05-27
2005-05-27
2005-05-27
2005-05-27
2005-05-28
2005-05-29
2005-05-29
2005-05-29
2005-05-28
2005-05-28
2005-05-29
2005-05-29
Sessions in mod_python (was [Quixote-users] Session persistence...
2005-05-29
Session persistence for Quixote 2.0
Titus Brown
2005-05-26
Hi all,

I sat down and implemented simple persistent session stores for Durus,
PostgreSQL, and shelve, as well as a simple directory/file based
session store.  My initial distribution is available here:

        http://issola.caltech.edu/~t/transfer/qx-sessions.tar.gz

The catch?  You have to switch SessionManager classes, because I
rewrote the core logic of SessionManager to better match my
requirements.  You can read more about it here:

        http://www.advogato.org/person/titus/diary.html?start=92

The short version is that the SessionManager included with Quixote
is aimed at a single-process object-database backend like Durus, and it
has been difficult for me to make it work nicely with other backends, or
with threads.  YMMV, and I'd be interested to find out what my own blind
spot(s) is/are...

In any case, the PersistentSessionManager class takes a session storage
object as an argument; the SessionStore object API looks like this:

class SessionStore:
    def load_session(self, id, default=None):
        pass

    def save_session(self, session):
        pass

    def delete_session(self, session):
        pass

(This is about as simple as I can make it ;).

I would appreciate both comments & criticisms, of course.

Note that under the 'test/' directory of the above distribution there is
a test class that provides a simple demonstration of session
persistence.  If you want to run the automated tests under
'test/twill-tests', you'll need the latest version of twill at

        http://darcs.idyll.org/~t/projects/twill-latest.tar.gz

Thanks to Mike Orr for beating me about the head (politely), and David
Binger for answering my nonsensical questions ;).

cheers,
--titus
reply