[Zope] Core Session Tracking & DTML
Chris McDonough
chrism@digicool.com
Wed, 3 Jan 2001 11:33:56 -0500
> Chris McDonough wrote:
>
> > > sessionmanager.SessionData.a
> > >
> > > ...or something similar?
> >
> > Yes. That's what Bob S. suggested. What are the benefits of this?
>
> More graceful code that's more 'pythonesque' in Python Scripts:
>
> if sessionmanager.SessionData.a['mykey'] == 1:
> ...as opposed to...
> if sessionmanager.SessionData.get('a')['mykey'] == 1:
The current way is:
if sessiondatamanager.getSessionData()['mykey'] == 1:
.. do something...
I suppose you'd rather see:
if sessiondatamanager.getSessionData().mykey == 1:
.. do something...
Is this really worth it?
> sessionmanager.SessionData.b = 1
> ...as opposed to...
> if sessionmanager.SessionData.set('b',1)
And this is currently:
sessiondatamanager.getSessionData().set('b',1)
You can't do assignment in DTML, and session-tracking needs to be usable
from DTML, so the "ob.attr = val" idiom is out from the get-go. Another
assumption I'm making is that "there should only be one way to do it". I'd
rather not have both __setattr__ and .set work for session data objects,
because it's confusing and doesn't buy anything at all other than a couple
keystrokes.