ApplicationSession

class ApplicationSession

Session storage using a simple class-level dict for persistent session across the lifetime of the app.

Examples

# create the session object
session = ApplicationSession()
# set a variable
session.some_variable = 42
# if you know the variable has been set you can retrieve its value using
value = session.get('some_variable')
# with explicit default value
value = session.get('some_variable', default=1)
# or, if you don't know whether the variable has been set or not
try:
    value = session.some_variable
except AttributeError:
    value = None
# clear the session
session.clear()