Edit me on GitHub

pyramid_zodbsessions API

pyramid_zodbsessions.SessionFactoryConfig(secret, timeout=1200, period=300, cookie_name='session_id', cookie_max_age=None, cookie_path='/', cookie_domain=None, cookie_secure=False, cookie_httponly=False, cookie_on_exception=True, dbname=None, rootname='sessions')

Configure a session factory which will provide session data based on the repoze.session and pyramid_zodbconn libraries.

The return value of this function is a session factory, which may be provided as the session_factory argument of a pyramid.config.Configurator constructor, or used as the session_factory argument of the pyramid.config.Configurator.set_session_factory() method.

Parameters:

secret
A string which is used to sign the cookie.
timeout
A number of seconds of inactivity before a session times out.
period
Granularity of inactivity checking in seconds (should be lower than timeout).
cookie_name
The name of the cookie used for sessioning. Default: session.
cookie_max_age
The maximum age of the cookie used for sessioning (in seconds). Default: None (browser scope).
cookie_path
The path used for the session cookie. Default: /.
cookie_domain
The domain used for the session cookie. Default: None (no domain).
cookie_secure
The ‘secure’ flag of the session cookie. Default: False.
cookie_httponly
The ‘httpOnly’ flag of the session cookie. Default: False.
cookie_on_exception
If True, set a session cookie even if an exception occurs while rendering a view. Default: True.
dbname
The database name passed to pyramid_zodbconn.get_connection. If this is not provided, the unnamed connection will be used.
rootname
The key under which the ZODB session manager should be stored in the ZODB root.

Previous topic

pyramid_zodbsessions

Next topic

Glossary