WebKit.Session | index /usr/local/share/webware/WebKit/Session.py

`Implementation of client sessions.`

Modules

``

re |  |  |

Classes

``

__builtin__.object
  Session
exceptions.Exception(exceptions.BaseException)
  SessionError

class Session(__builtin__.object)

``

`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.
FUTURE
* invalidate()
* 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'.`

creationTime(self)
  `Return the time when this session was created.`

delValue(self, name)

expiring(self)
  `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)

identifier(self)
  `Return a string that uniquely identifies the session.
  This method will create the identifier if needed.`

invalidate(self)
  `Invalidate the session.
  It will be discarded the next time it is accessed.`

isDirty(self)
  `Check whether the session is dirty (has unsaved changes).`

isExpired(self)
  `Check whether the session has been previously expired.
  See also: expiring()`

isNew(self)
  `Check whether the session is new.`

lastAccessTime(self)
  `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.`

timeout(self)
  `Return the timeout for this session in seconds.`

value(self, name, default=<class 'MiscUtils.NoDefault'>)

values(self)

writeExceptionReport(self, handler)

Data descriptors defined here:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

class SessionError(exceptions.Exception)
`` | `Client session error`

Method resolution order:
  SessionError
  exceptions.Exception
  exceptions.BaseException
  __builtin__.object

Data descriptors defined here:

__weakref__
  `list of weak references to the object (if defined)`

Methods inherited from exceptions.Exception:

__init__(...)
  `x.__init__(...) initializes x; see help(type(x)) for signature`

Data and other attributes inherited from exceptions.Exception:

__new__ = <built-in method __new__ of type object>
  `T.__new__(S, ...) -> a new object with type S, a subtype of T`

Methods inherited from exceptions.BaseException:

__delattr__(...)
  `x.__delattr__('name') <==> del x.name`

__getattribute__(...)
  `x.__getattribute__('name') <==> x.name`

__getitem__(...)
  `x.__getitem__(y) <==> x[y]`

__getslice__(...)
  `x.__getslice__(i, j) <==> x[i:j]
  Use of negative indices is not supported.`

__reduce__(...)

__repr__(...)
  `x.__repr__() <==> repr(x)`

__setattr__(...)
  `x.__setattr__('name', value) <==> x.name = value`

__setstate__(...)

__str__(...)
  `x.__str__() <==> str(x)`

__unicode__(...)

Data descriptors inherited from exceptions.BaseException:

__dict__

args

message

Functions

``

localtime(...)
  `localtime([seconds]) -> (tm_year,tm_mon,tm_mday,tm_hour,tm_min,
  tm_sec,tm_wday,tm_yday,tm_isdst)
  Convert seconds since the Epoch to a time tuple expressing local time.
  When 'seconds' is not passed in, convert the current time instead.`

time(...)
  `time() -> floating point number
  Return the current time in seconds since the Epoch.
  Fractions of a second may be present if the system clock provides them.`