-> On Sat, Feb 28, 2004 at 08:09:17PM -0800, Titus Brown wrote:
-> > 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).
[ munch ]
-> Does that work for you?
As it turns out -- maybe not ;).
The only time a real 'request' object is available is when the session is
being created as a direct result of a Web access. This means that unless
you use Object Magic (tm) to create the object from a database *without*
going through the __init__ function, you're stuck with creating a fake
'request' object that mimics the get_environ function.
On purist grounds, I think this is an unreasonable requirement borne
from the original design around ZODB.
In practice, I can fake it, of course...
cheers,
--titus