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-18
-> 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?

As it turns out -- yes.  Do you want a patch against session.py changing the
prefixes from __ to _?  (I literally did a query-replace in emacs; that
worked fine.)

I've revamped my sql_example code to use the new method; it's available
here:

        http://issola.caltech.edu/~t/transfer/sql_example-17.3.04.tar.gz

It's been educational -- thanks ;).

cheers,
--titus


reply