Python: module pyweblib.session

pyweblib.session (version 0.3.4) | index /usr/lib/python2.3/site-packages/pyweblib/session.py

`pyweblib.session - server-side web session handling
(C) 2001 by Michael Stroeder <michael@stroeder.com>
This module implements server side session handling stored in
arbitrary string-keyed dictionary objects
This module is distributed under the terms of the
GPL (GNU GENERAL PUBLIC LICENSE) Version 2
(see http://www.gnu.org/copyleft/gpl.html)
$Id: pyweblib.session.html,v 1.13 2004/08/24 10:26:30 michael Exp $`

Modules
`` |  |
pickle random | re string | threading time |

Classes
`` |  | exceptions.Exception SessionException BadSessionId CorruptData GenerateIDError InvalidSessionId MaxSessionCountExceeded SessionExpired SessionHijacked threading.Thread(threading._Verbose) CleanUpThread WebSession
class BadSessionId(SessionException)
`` | `Raised if session ID not found in session dictionary.`
| Method resolution order: BadSessionId SessionException exceptions.Exception Methods defined here: __init__(self, session_id) __str__(self) Methods inherited from exceptions.Exception: __getitem__(...)
class CleanUpThread(threading.Thread)
`` | `Thread class for clean-up thread`
| Method resolution order: CleanUpThread threading.Thread threading._Verbose __builtin__.object Methods defined here: __init__(self, sessionInstance, interval=60) __repr__(self) join(self, timeout=0.0) run(self) `Thread function for cleaning up session database` Methods inherited from threading.Thread: getName(self) isAlive(self) isDaemon(self) setDaemon(self, daemonic) setName(self, name) start(self) Data and other attributes inherited from threading._Verbose: __dict__ = <dictproxy object> `dictionary for instance variables (if defined)` __weakref__ = <attribute '__weakref__' of '_Verbose' objects> `list of weak references to the object (if defined)`
class CorruptData(SessionException)
`` | `Raised if data was corrupt, e.g. UnpicklingError occured`
| Method resolution order: CorruptData SessionException exceptions.Exception Methods defined here: __str__(self) Methods inherited from SessionException: __init__(self, *args) Methods inherited from exceptions.Exception: __getitem__(...)
class GenerateIDError(SessionException)
`` | `Raised if generation of unique session ID failed.`
| Method resolution order: GenerateIDError SessionException exceptions.Exception Methods defined here: __init__(self, maxtry) __str__(self) Methods inherited from exceptions.Exception: __getitem__(...)
class InvalidSessionId(SessionException)
`` | `Raised if session ID not found in session dictionary.`
| Method resolution order: InvalidSessionId SessionException exceptions.Exception Methods defined here: __init__(self, session_id) __str__(self) Methods inherited from exceptions.Exception: __getitem__(...)
class MaxSessionCountExceeded(SessionException)
`` | `Raised if maximum number of sessions is exceeded.`
| Method resolution order: MaxSessionCountExceeded SessionException exceptions.Exception Methods defined here: __init__(self, max_session_count) __str__(self) Methods inherited from exceptions.Exception: __getitem__(...)
class SessionException(exceptions.Exception)
`` | `Raised if`
| Methods defined here: __init__(self, *args) Methods inherited from exceptions.Exception: __getitem__(...) __str__(...)
class SessionExpired(SessionException)
`` | `Raised if session is expired.`
| Method resolution order: SessionExpired SessionException exceptions.Exception Methods defined here: __init__(self, timestamp, session_data) __str__(self) Methods inherited from exceptions.Exception: __getitem__(...)
class SessionHijacked(SessionException)
`` | `Raised if hijacking of session was detected.`
| Method resolution order: SessionHijacked SessionException exceptions.Exception Methods defined here: __init__(self, failed_vars) __str__(self) Methods inherited from exceptions.Exception: __getitem__(...)
class WebSession
`` | `The session class which handles storing and retrieving of session data in a dictionary-like sessiondict object.`
| Methods defined here: __init__(self, dictobj=None, expireDeactivate=0, expireRemove=0, crossCheckVars=None, maxSessionCount=None) `dictobj has to be a instance of a dictionary-like object (e.g. derived from UserDict or shelve) expireDeactivate amount of time (secs) after which a session expires and a SessionExpired exception is raised which contains the session data. expireRemove Amount of time (secs) after which a session expires and the session data is silently deleted. A InvalidSessionId exception is raised in this case if the application trys to access the session ID again. crossCheckVars List of keys of variables cross-checked for each retrieval of session data in retrieveSession(). If None SESSION_CROSSCHECKVARS is used. maxSessionCount Maximum number of valid sessions. This affects behaviour of retrieveSession() which raises. None means unlimited number of sessions.` cleanUp(self) `Search for expired session entries and delete them. Returns integer counter of deleted sessions as result.` close(self) `Call close() if self.sessiondict has .close() method` deleteSession(self, session_id) `Delete session_data referenced by session_id.` newSession(self, env={}) `Store session data under session id` retrieveSession(self, session_id, env={}) `Retrieve session data` storeSession(self, session_id, session_data) `Store session_data under session_id.` sync(self) `Call sync if self.sessiondict has .sync() method`

Functions
`` |  | ThreadingLock = allocate_lock(...) `allocate_lock() -> lock object (allocate() is an obsolete synonym) Create a new lock object. See LockType.__doc__ for information about locks.`

Data
`` |  | SESSION_CROSSCHECKVARS = ('\n List of environment variables assumed to be c...gh a network of web proxy siblings.\n REMOTE_ADDR', 'REMOTE_HOST', 'REMOTE_IDENT', 'REMOTE_USER', 'FORWARDED_FOR', 'HTTP_X_FORWARDED_FOR', 'HTTP_USER_AGENT', 'HTTP_ACCEPT_CHARSET', 'SSL_SESSION_ID', 'SSL_CLIENT_V_START', 'SSL_CLIENT_V_END', 'SSL_CLIENT_I_DN', 'SSL_CLIENT_IDN', 'SSL_CLIENT_S_DN', 'SSL_CLIENT_SDN', 'SSL_CLIENT_M_SERIAL', 'SSL_CLIENT_CERT_SERIAL') SESSION_ID_CHARS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' __version__ = '0.3.4'