[Zope-dev] Re: [Zope-Annce] DTML Eval Tag Released

Casey Duncan casey_duncan@yahoo.com
Sat, 3 Feb 2001 22:05:21 -0800 (PST)


--- Phill Hugo <phill@gnu.org> wrote:
> Hi Casey,
> 
> This looks good but I got the feeling that it may be
> better to use the
> RESPONSE object to store variables in since this
> won't taint the input
> REQUEST. I'm not sure what your feeling is in this
> regard (I'm not sure
> the RESPONSE object is ever used for variable lookup
> as the REQUEST is
> (albeit last of all)) - this could actually be a
> good thing though as it
> would force people to use RESPONSE['variable'] in
> all cases rather than
> sometimes using variable and sometimes
> REQUEST['variable'] depending on
> the variable's name.
> 
> The other option would be to pop them on top of the
> namespace as the
> _.namespace method and dtml-let tag seem to do. This
> would remove the
> need to alter either REQUEST or RESPONSE. I'm not
> sure how
> straightforward this would be though.
> 
> Let me know your thoughts,
> 
> Phill
> 
> 
Hi Phill,

Thanks for the feedback. As for the REQUEST vs.
RESPONSE usage, the latter can't be used to store
values and is really there as a way to communicate to
the browser. The former is used pretty regularly to
store scratch variables already.

I agree that a better solution is to use a namespace.
That was my original intention. However, namespaces
must be explicitly scoped (ala dtml-let). That is, you
can't create (push) one without explicitly popping it
back off later down the road before the method ends.
One of the primary goals of the eval tag was that you
can assign variables that implicitly have the same
scope as the method they are in, just like any other
decent language.

I also considered just manipulating whatever namespace
happened to be on top of the stack, but there is no
guarantee that the top NS is a mutable object, so that
wouldn't work.

A possible solution to this is for the method to push
an empty scratch namespace for itself when it starts
and pop it when it finishes. Then the eval tag can
just use this namespace to store variables. I
considered that too complex for my first release, but
I certainly will reconsider it for future ones.

Again thanks for the feedback.

=====
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`----------------->

__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/