Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 1.54 KB

usage.rst

File metadata and controls

50 lines (37 loc) · 1.54 KB

repoze.session Usage

repoze.session is sessioning system for Python web applications.

Using Session Data Objects and Expiration

repoze.session automatically expires sessions which have been inactive for some timeout.

Here is an example of using the sessioning machinery in one of your applications:

code/sample.py

The value you send in to the session manager's get method should be a value you've managed to assign to a particular user, perhaps via a cookie. See repoze.browserid for a library that manages browser identifiers. These identifiers can be used as session manager keys.

Using Begin and End Subscribers

repoze.session allows you to register session-end and session-begin subscribers in order to react to the start and end of a session.

code/subscribers.py

Gotchas

Values inserted into a repoze.session session store should not subclass ZODB Persistent class. If they do, there is a chance that irresolveable cross-database references will put into the session manager's (separate) database.

When the ConnectionManager 's commit method is called, it will commit a transaction for all databases participating in Zope transaction management. Don't use this method if you already have transaction management enabled in another way.