Responding to both of your messages in this one...

Actually, in the current implementation, session data objects are not
acquirers, so the syntax you're advocating won't do what you think it might.
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.  This could be changed.  We could make
data objects acquirers.  I can see the rationale for something like this,
where you want to "fall through" to a default acquired value.   Session data
object interaction with acquisition was something I didn't think about at
all.  I'm glad you've brought it up.

Note that it's also possible to do something like:

<dtml-let bar=amethodcall>
  <dtml-with sessiondatamanager>
    <dtml-with getSessionData>
      <dtml-var "get('foo', bar)">

Which will return the rendering of bar (which is itself the result of
'amethodcall') if a value for 'foo' cannot be found.  This is way more
verbose than just acquiring 'amethodcall', but it's very understandable.

Currently, I'm leaning towards leaving it explicit both in syntax (explicit
set and get methods) and semantics (no acquisition), because we've gotten in
a lot of trouble in the past when attempting to do likeminded magical
things -- like making all common Zope objects acquisition-implicit.  And
although acquisition isn't that magical, it can sure blow up on you when you
don't know what you're doing.  Murphy's law says that this will happen to
every newbie, and I'll be left holding the bag.  ;-)

As for some of your other points:  The current interface is very verbose.
I'm just not sure that's such a bad thing.  :-)  You can do something like:

<dtml-call "sessiondatamgr.getSessionData().set('aname', 'avalue')">

... if you don't want to do all the <dtml-with>s and -lets.

God help me though, I am thinking of aliasing the __call__ method of a
session data manager to getSessionData, so that this would work:

<dtml-with sessiondatamgr>
   <dtml-call "set('aname', 'avalue')">

or this:

<dtml-call "sessiondatamgr().set('aname', 'avalue')">

This might be explainable.  It reminds me however of a similar feature of
the catalog that is very hard to explain (the aliasing of searchResults to
__call__), and it makes me want to not do it.  If I do do it, getSessionData
will disappear from the interface, and there will only be one way to do it
(via a session data manager's __call__).

I'm not sure I understand your desire to do:

<dtml-call "sessiondatamanager.set('a')">

I particularly don't understand what would end up getting rendered if (as
per your syntax) you subsequently did:

<dtml-var "sessiondatamanager.a">

I sympathize with the need to convert all your scripts over to use
sessioning from hidden form-field encoding and the like... I'd really
appreciate some input as to what kinds of problems you're trying to solve
with sessioning, because this implementation was done sort of clean-room
style and thus may lack real-world practicality.  I haven't used it as a
component in any development personally.  Having some real examples of
conversion work or initial implementation work to chew on might help me
markedly improve the implementation.  Some of my arguments may be an
overreaction to past problems, and you may need to straighten me out with
some examples of how making session data objects acquirers and making the
interface less verbose could help more than it could hurt in a real-world

Thanks much for all the input!

- C

----- Original Message -----
From: "Bob Sidebotham" <[EMAIL PROTECTED]>
Sent: Tuesday, January 02, 2001 11:55 PM
Subject: Re: [Zope] Core Session Tracking kudos & namespaces

> The advantage of the last form (below), is that you can use
> acquisition, and don't need to know whether the variable came from the
> session or from elsewhere. If you *really* want it to come from the
> session only, you can always add the "only" tag to the dtml-with call.
> In conjunction with this, it might be nice to have a special call that
> sets the variable, if defined by acquisition, in the session. Something
> like <dtml-call "sessionmanager.getSessionData.set('a')"> would set "a"
> to the acquired value for "a", leave it undefined if not defined, and
> not change it if it was not acquirable elsewhere (the acquired value
> would take precedence over the session value).
> Even better would be if I could just say <dtml-call
> "SESSION.set('a')">.
> Bob
> --- Chris McDonough <[EMAIL PROTECTED]> wrote:
> > A potential rhythm, however, might look like:
> >
> >   <dtml-with sessionmanager>
> >     <dtml-with getSessionData>
> >       <dtml-call "set('a', 'b')">
> >     </dtml-with>
> >   </dtml-with>
> >
> >    and
> >
> >   <dtml-with sessionmanager>
> >     <dtml-with getSessionData>
> >       <dtml-var a>
> >     </dtml-with>
> >   </dtml-with>
> >
> > I sorta like it the original way now that I've written that down.
> > :-)  It's
> > easier to explain, AFAICS.
> >
> >
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Photos - Share your holiday photos online!

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to