durusmail: quixote-users: SQL-based session persistence techniques.
SQL-based session persistence techniques.
2004-02-22
2004-02-29
2004-03-01
2004-03-05
2004-03-18
SQL-based session persistence techniques.
Titus Brown
2004-03-01
-> > Attached; it does two things:
-> >
-> > * Session.__init__ now takes as arguments (id, remote_addr,
create_time=None)
-> >    and sets creation time to time() by default;
-> >
-> > * SessionManager.new_session instantiates session_class with remote_addr
-> >    directly:
-> >
-> >    session = self.session_class(id, request.get_environ('REMOTE_ADDR'))
->
-> After further though, I would prefer that the signature of Session
-> not be changed.  It's possible that some application sessions are
-> not interested in 'remote_address' or they want to use some other
-> data in the request when creating sessions (e.g. cookies).
->
-> Instead, I propose that the '__remote_address', '__creation_time'
-> and '__access_time' be renamed to '_remote_address',
-> '_creation_time', and '_access_time'.
->
-> For your case, you could make your session class a new-style class:
->
->     class MySession(object, Session):
->         [...]
->
-> and to restore it from the DB you can use __new__:
->
->     s = MySession.__new__()
->     s.id = ...
->     ...
->
-> Does that work for you?

Certainly (although to be honest I don't know anything about new-style
classes -- perhaps this will be my time to learn about it... ;)

cheers,
--titus


reply