Package session2 :: Package store :: Module PostgresSessionStore :: Class PostgresSessionStore
[frames | no frames]

Class PostgresSessionStore

SessionStore --+
               |
              PostgresSessionStore


Store pickled sessions in an SQL database.

See the create() function for the table definition.

This implementation has been tested with psycopg. It should work with any DB-API module that supports connection.rollback() and "%(var)s" substitution style, e.g. psycopg.


Method Summary
  __init__(self, conn, table)
__init__ takes a psycopg connection to a PostgreSQL database, together with an optional table name, 'table'.
  delete_session(self, session)
Delete session from the database.
  load_session(self, id, default)
Load a pickled session from the database.
  save_session(self, session)
Pickle session & save it into the database.
  setup(self)
Initialize the session store; e.g., create required database tables.
    Inherited from SessionStore
  delete_old_sessions(self, minutes)
Delete all sessions that have not been modified for N minutes.
  has_session(self, id)
Return true if the session exists in the store, else false.
  iter_sessions(self)
Return an iterable of (id, session) for all sessions in the store.

Class Variable Summary
bool is_multiprocess_safe = True
bool is_thread_safe = False

Method Details

__init__(self, conn, table=None)
(Constructor)

__init__ takes a psycopg connection to a PostgreSQL database, together with an optional table name, 'table'.

delete_session(self, session)

Delete session from the database.

Overrides:
session2.store.SessionStore.SessionStore.delete_session

load_session(self, id, default=None)

Load a pickled session from the database.

Overrides:
session2.store.SessionStore.SessionStore.load_session

save_session(self, session)

Pickle session & save it into the database.

Overrides:
session2.store.SessionStore.SessionStore.save_session

setup(self)

Initialize the session store; e.g., create required database tables. If a previous store exists, overwrite it or raise an error. The default implmenetation does nothing, meaning no setup is necessary.

This method is never called by the session manager; it's for your application setup program.

Overrides:
session2.store.SessionStore.SessionStore.setup (inherited documentation)

Class Variable Details

is_multiprocess_safe

Type:
bool
Value:
True                                                                   

is_thread_safe

Type:
bool
Value:
False                                                                  

Generated by Epydoc 2.1 on Sat Feb 4 16:40:10 2006 http://epydoc.sf.net