Module rhino.ext.session

This module contains classes that can be used to add session support for Rhino applications.

This extension requires the Beaker module to be installed:

$ pip install beaker

The CookieSession class provides a simple and easy to use signed cookie-based session.

The BeakerSession class provides access to the different backends provided by beaker.session.

Both classes use the SessionObject class as the interface to the session that subclasses Beaker's SessionObject to add support for "flashed" messages.

Classes

class BeakerSession

Adds a session property to the context.

__init__(**session_args)

class CookieSession

Inherits from rhino.ext.session.BeakerSession.

Adds a session based on signed cookies to the context.

__init__(secret, timeout=None, cookie_name='session_id', cookie_expires=True, cookie_domain=None, cookie_path='/', secure=False, httponly=False, auto=True)

class SessionObject

Inherits from beaker.session.SessionObject.

A session object with support for "flashed" messages.

__init__(environ, **params)

add_message(text, type=None)

Add a message with an optional type.

pop_messages(type=None)

Retrieve stored messages and remove them from the session.

Return all messages with a specific type, or all messages when type is None. Messages are returned in the order they were added. All messages returned in this way are removed from the session and will not be returned in subsequent calls.

Returns a list of namedtuples with the fields (type, text).