||Implementation of client sessions.|
All methods that deal with time stamps, such as creationTime(),
treat time as the number of seconds since January 1, 1970.
Session identifiers are stored in cookies. Therefore, clients
must have cookies enabled.
Unlike Response and Request, which have HTTP subclass versions
(e.g., HTTPRequest and HTTPResponse respectively), Session does
not. This is because there is nothing protocol specific in
Session. (Is that true considering cookies? @@ 2000-04-09 ce)
2000-04-27 ce: With regards to ids/cookies, maybe the notion
of a session id should be part of the interface of a Request.
Note that the session id should be a string that is valid
as part of a filename. This is currently true, and should
be maintained if the session id generation technique is
modified. Session ids can be used in filenames.
* Sessions don't actually time out and invalidate themselves.
* Should this be called 'HTTPSession'?
* Should "numTransactions" be exposed as a method? Should it
be common to all transaction objects that do the
awake()-respond()-sleep() thing? And should there be an
abstract super class to codify that?
||Methods defined here:|
- __contains__(self, name)
- __delitem__(self, name)
- __getitem__(self, name)
- __init__(self, trans, identifier=None)
- __setitem__(self, name, value)
- awake(self, trans)
- Let the session awake.
Invoked during the beginning of a transaction, giving a Session an
opportunity to perform any required setup. The default implementation
updates the 'lastAccessTime'.
- Return the time when this session was created.
- delValue(self, name)
- Let the session expire.
Called when session is expired by the application.
Subclasses should invoke super.
Session store __delitem__()s should invoke if not isExpired().
- hasValue(self, name)
- Return a string that uniquely identifies the session.
This method will create the identifier if needed.
- Invalidate the session.
It will be discarded the next time it is accessed.
- Check whether the session is dirty (has unsaved changes).
- Check whether the session has been previously expired.
See also: expiring()
- Check whether the session is new.
- Get last access time.
Returns the last time the user accessed the session through
interaction. This attribute is updated in awake(), which is
invoked at the beginning of a transaction.
- respond(self, trans)
- Let the session respond to a request.
The default implementation does nothing, but could do something
in the future. Subclasses should invoke super.
- sessionEncode(self, url)
- Encode the session ID as a parameter to a url.
- setDirty(self, dirty=True)
- Set the dirty status of the session.
- setTimeout(self, timeout)
- Set the timeout on this session in seconds.
- setValue(self, name, value)
- sleep(self, trans)
- Let the session sleep again.
Invoked during the ending of a transaction, giving a Session an
opportunity to perform any required shutdown. The default
implementation does nothing, but could do something in the future.
Subclasses should invoke super.
- Return the timeout for this session in seconds.
- value(self, name, default=<class 'MiscUtils.NoDefault'>)
- writeExceptionReport(self, handler)
Data descriptors defined here:
- dictionary for instance variables (if defined)
- list of weak references to the object (if defined)