It seems to me that the Session type object as used in SQLSession is a useful general class of object (regardless of the backend storage). Is it worth making this a more general piece of Zope? Right now, you have to do a <dtml-call Session> at the start of the transaction to get the REQUEST.SESSION object created - it would be nice if this was done automagically (and done in a way that allowed you to slot in a different Session object if you wanted it...) Any thoughts? Anthony
On Thu, 18 Nov 1999, Anthony Baxter wrote:
Is it worth making this a more general piece of Zope? Right now, you
I think yes.
have to do a <dtml-call Session> at the start of the transaction to get the REQUEST.SESSION object created - it would be nice if this was done automagically (and done in a way that allowed you to slot in a different Session object if you wanted it...)
A few thoughts ... The session should not be created in every transation. You could achieve some automation by replacing REQUEST.SESSION with a function. Whenever you want to save or retrieve something you could do: <dtml-call "Session.set('a',2)">. Your method would then query the db (or whatever backend you use). Retrieval of data should also inlude caching so that session data are cached across transactions, if not modified. Also the default backend should be one that does not require additional components not shipped with standard Zope. SQL,bsddb etc should be optional backends. Just my morning thoughts ... Pavlos
On 11/18/99 7:43 AM, Anthony Baxter at anthony@interlink.com.au wrote:
It seems to me that the Session type object as used in SQLSession is a useful general class of object (regardless of the backend storage).
Is it worth making this a more general piece of Zope? Right now, you have to do a <dtml-call Session> at the start of the transaction to get the REQUEST.SESSION object created - it would be nice if this was done automagically (and done in a way that allowed you to slot in a different Session object if you wanted it...)
I haven't had a chance to look at your product yet Anthony, so excuse any idiotic assumptions... what we've talked about---but never gotten to yet---was either a modification to Folder, or a new ObjectManager that would cause Sessions to be tracked from that level down. This would probably work well, I think. Chris -- | Christopher Petrilli Python Powered Digital Creations, Inc. | petrilli@digicool.com http://www.digicool.com
On Thu, 18 Nov 1999, Anthony Baxter wrote:
It seems to me that the Session type object as used in SQLSession is a useful general class of object (regardless of the backend storage).
There is a need for someone to write ZSession or DumbSession that simply stores the information in a in-memory dictionary (or var/session for ZEO compatibility?), which would then define the API.
Is it worth making this a more general piece of Zope? Right now, you have to do a <dtml-call Session> at the start of the transaction to get the REQUEST.SESSION object created - it would be nice if this was done automagically (and done in a way that allowed you to slot in a different Session object if you wanted it...)
How would you 'slot in' a session? Perhaps it just calls getSession(this(),REQUEST), which would be aquired from higher-on-up. This method could defined in SQLSessionFolder, or just a DTML/external method the site manager left in the root folder, or we could patch OFS/Folder.py to give it a 'Session' property defining the class of the session object we use). The getSession method would return the existing session, if it exists, or returns a fresh one. Your code would then just look like: <dtml-let session=getSession> blah </dtml-let> It would be nice if REQUEST.SESSION was filled in for you if the session class has been defined, but someone else will need to comment on its feasibility :-) -- ___ // Zen (alias Stuart Bishop) Work: zen@cs.rmit.edu.au // E N Senior Systems Alchemist Play: zen@shangri-la.dropbear.id.au //__ Computer Science, RMIT WWW: http://www.cs.rmit.edu.au/~zen
participants (4)
-
Anthony Baxter -
Christopher Petrilli -
Pavlos Christoforou -
Stuart 'Zen' Bishop