[Zope] Session Management
Anthony Baxter
Anthony Baxter <anthony@interlink.com.au>
Tue, 04 Jan 2000 14:51:33 +1100
>>> Pavlos Christoforou wrote
> I will add _force_new_session as well as a corresponding method. Maybe we
> should decide on some common interface/API to make it easier for users to
> switch from one to the other.
Excellent plan. I can see two interfaces to define:
The interface to the Session object (the thing that's called to
populate REQUEST with the SESSION object)
The interface to the SESSION object (the dictionary-like thing
that's inserted into the REQUEST).
SESSION API:
SESSION.getName() - returns the session id of the current session.
Supports dictionary interface, that is:
SESSION.__getitem__
SESSION.__setitem__
SESSION.__delitem__
SESSION.keys
SESSION.values
SESSION.items
SESSION.has_key
SESSION.clear
SESSION.update
Query: should it also support __getattr__ ? I've resisted it so far as
'feature duplication', since there's nothing that you absolutely _need_
it for - e.g. for <dtml-with> you can just write <dtml-with SESSION mapping>
to put the SESSION values in the namespace.
SESSION.copy - unimplemented, raises error.
SESSION.get -- alias for SESSION.__getitem__
SESSION.set -- alias for SESSION.__getitem__
Session object API:
Session.__call__(REQUEST=None, session_id=None, noCookie=None,
validSession=None)
if noCookie is set, do _not_ set a cookie.
if validSession is set, do _not_ create a new session if none is
specified, or if the one specified is invalid.
if session_id is set, use this ID to connect to an existing session
(and populate REQUEST.SESSION and any cookie, as appropriate).
if REQUEST._force_new_session = 1, then always create a new session.
returns the string '<!-- session is "%s" -->'%sessionName (useful
for debugging, use dtml-var Session, rather than dtml-call Session.
Session.cookie_name - string containing the name of the session cookie.
This list is just cribbed from the CVS of release 0.2.3...
Did I miss anything - and is there anything from FSSession that should be
included?
Anthony