[Welcome] [TitleIndex] [WordIndex

Problem

You wish to store server-side information about client agents; this information should follow around users as they browse through the application.

Solution

Enable sessions by using the SessionPublisher class instead of the regular Publisher. In your top-level script, simply do:

from quixote.publish import SessionPublisher
...
publisher = SessionPublisher()

Discussion

SessionPublisher uses two auxiliary classes:

The standard version of SessionManager stores sessions in a Python dictionary. This means that you must be invoking Quixote through some mechanism that uses long-lived processes; this rules out CGI, but any of FastCGI/SCGI/mod_python will work fine. If you have multiple processes, though, sessions will not be shared between them. For such situations you would have to write a SessionManager subclass that stored sessions in a relational database or disk file.


CategoryCookbook CategoryQuixote1


2010-09-22 22:14