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

2001-02-04 Thread Phill Hugo

Casey Duncan wrote:

 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.

Looks like the set() method has been removed from 2.3. I remember using
it many a time in 2.2 and 2.1 to do this kind of thing though.

RESPONSE.set() worked in the same way as REQUEST.set() but without
messing REQUEST up (which in the same light is just a way for the
browser to communicate with you)

Looks like RESPONSE.__setitem__ maps things directly to the setHeader()
method.

snip

 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.

This does sound like the way to go.

Phill

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



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

2001-02-03 Thread Casey Duncan

--- Phill Hugo [EMAIL PROTECTED] 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.
| [EMAIL PROTECTED]
`-

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

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )