[Web-SIG] and now for something completely different!
ksenia at ksenia.nl
Fri Aug 12 23:42:52 CEST 2005
Op 12-aug-2005, om 23:08 heeft mso at oz.net het volgende geschreven:
> If a Quixote application were installed in Paste and used a third-
> session manager, the session object would have to:
> - allow arbitary attributes.
> - default .user to None.
> - have a .set_user(user) method that merely sets .user.
> Otherwise people would have to modify their applications.
Actually I migrated lately few old applications from Quixote1
"native" sessions to Flup Session middleware :)
Except from arbitrary attributes that I don't have, this is it:
from flup import session
from quixote import publish
if self._user is not None:
# some app-specific code to get user from db
def _set_user(self, user):
# user is SQLObject instance, we can only store ID
if user is None:
self._user = None
self._user = user.id
def set_user(self, user):
self.user = user
session.Session.user = property(_get_user, _set_user)
session.Session.set_user = set_user
def start_request(self, request):
request.session = request.environ
More information about the Web-SIG