Re: [Zope] Core Session Tracking kudos & namespaces
Chris McDonough writes:
.... Currently, nothing would be acquired, and the <dtml-var a> call will fail inside of a "with sessiondatamanager" even if we did have a __getattr__ interface to session data objects.... Are you sure?
As I understand it, at least a <dtml-with "sessionDataManager.getSessionData()"> would make available all session data keys as variables, if they had a "__getattr__". If they had a "__getitem__" (maybe, the available "get" is already sufficient), then <dtml-with "sessionDataManager.getSessionData()" mapping> would do the trick. Dieter
You're right, Dieter. I was thinking in Python terms and forgot about DTML namespace lookup rules. :-( Yes, if we had a __getattr__ interface or used the mapping keyword on the return value of a __getitem__-based session data object, and if the name was not found in the namespace that is put on the DTML stack by "with sessiondataobject", it would then be looked up in the form and cookies namespaces, then it would attempt to be acquired, etc. Sorry for the misinformation. So the question becomes: do we want DTML namespace lookup magic or no DTML namespace lookup magic for names that we attempt to look up in a session data object? I don't know the answer. I'm so sick of magic at this point that I'm apt to vote "no", but if it affords us some provable real-world benefits, I could change this vote. If someone would be kind enough to give me an example where having DTML namespace lookup magic for names out of a session data object would be very useful, I'd consider it carefully. ----- Original Message ----- From: "Dieter Maurer" <dieter@handshake.de> To: "Chris McDonough" <chrism@digicool.com> Cc: "Bob Sidebotham" <bob_sidebotham@yahoo.com>; <zope@zope.org> Sent: Wednesday, January 03, 2001 4:50 PM Subject: Re: [Zope] Core Session Tracking kudos & namespaces
Chris McDonough writes:
.... Currently, nothing would be acquired, and the <dtml-var a> call will fail inside of a "with sessiondatamanager" even if we did have a __getattr__ interface to session data objects.... Are you sure?
As I understand it, at least a
<dtml-with "sessionDataManager.getSessionData()">
would make available all session data keys as variables, if they had a "__getattr__".
If they had a "__getitem__" (maybe, the available "get" is already sufficient), then
<dtml-with "sessionDataManager.getSessionData()" mapping>
would do the trick.
Dieter
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Chris McDonough wrote:
So the question becomes: do we want DTML namespace lookup magic or no DTML namespace lookup magic for names that we attempt to look up in a session data object? I don't know the answer. I'm so sick of magic at this point that I'm apt to vote "no", but if it affords us some provable real-world benefits, I could change this vote. If someone would be kind enough to give me an example where having DTML namespace lookup magic for names out of a session data object would be very useful, I'd consider it carefully.
Well, if you want to get something from the session, but it might not be there and you want to fall back to somethign that was submitted on the form or, more likely, is a property of some other object and hence acquirable. Of course, the best solution would be for the 'magic' lookup to be optional... cheers, Chris
----- Original Message ----- From: "Chris Withers" <chrisw@nipltd.com> To: "Chris McDonough" <chrism@digicool.com> Cc: "Dieter Maurer" <dieter@handshake.de>; "Bob Sidebotham" <bob_sidebotham@yahoo.com>; <zope@zope.org> Sent: Thursday, January 04, 2001 9:57 AM Subject: Re: [Zope] Core Session Tracking kudos & namespaces
Chris McDonough wrote:
So the question becomes: do we want DTML namespace lookup magic or no
DTML
namespace lookup magic for names that we attempt to look up in a session data object? I don't know the answer. I'm so sick of magic at this point that I'm apt to vote "no", but if it affords us some provable real-world benefits, I could change this vote. If someone would be kind enough to give me an example where having DTML namespace lookup magic for names out of a session data object would be very useful, I'd consider it carefully.
Well, if you want to get something from the session, but it might not be there and you want to fall back to somethign that was submitted on the form or, more likely, is a property of some other object and hence acquirable.
seconded. This would come in most handy right now for me.
Of course, the best solution would be for the 'magic' lookup to be optional...
That'd also be cool.
cheers,
Chris
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Chris McDonough writes:
So the question becomes: do we want DTML namespace lookup magic or no DTML namespace lookup magic for names that we attempt to look up in a session data object? .... Maybe, we do not want the magic automatically but have a simple way to call for it, when we like.
I think exposing the SessionData keys as attributes (in addition to exposing them as mapping keys) is a good thing. It allows to use: <dtml-XXXX expr="... sessionData.a ..." as well as <dtml-with sessionData> <dtml-var a> </dtml-with> i.e. place them in the DTML namespace, if we think they should go there. As said in an earlier message, it would be possible to bring them in the DTML namespace, if they would implement Python's mapping interface. In this case, we could use <dtml-with sessionData mapping> <dtml-var a> </dtml-with> We now use "FSSession" which implements the full Python mapping interface. We can use <dtml-with FSSession mapping>, if we think this is good. Usually, however, we put all relevant session data into REQUEST.form and REQUEST.other in setup code and allow the main code not to worry about session handling at all. Dieter
participants (4)
-
Chris McDonough -
Chris Withers -
Dieter Maurer -
Phil Harris