Re: [Zope] <!--#local--> and <!--#set--> (was Re: Proper way to set variables)
Excellent, this sounds like exactly what I need to fix. Can you send the patch along to me? "Phillip J. Eby" <pje@telecommunity.com> writes:
At 02:02 PM 9/8/99 -0500, John Goerzen wrote:
Heh, feels strange to reply to myself, but as I got no replies before, maybe I need to elaborate a bit. The original question is below.
My main confusion is just how do I set a variable that is dynamically scoped without having to use dtml-with or dtml-let, both of which require matching closing tags?
FYI, I have just written a patch for DT_Let.py that adds two new tags, 'local' and 'set'. They are used like this:
<!--#local myvar1="0" myvar2=somevar-->
<!--#set myvar1="myvar1+myvar2"--> ... <!--#set myvar2="myvar2+1"-->
<!--#/local-->
Both <!--#local--> blocks and <!--#set--> tags are dynamically scoped and <!--#set--> can be used anywhere as long as there is an enclosing <!--#local--> block defining the variable you want to set. You can only set variables which are defined by the innermost <!--#local--> block, but you can reset their value any number of times, even within the same <!--#set--> tag.
I am currently testing this code in an alpha app, but will be submitting it some time in the near future to Digital Creations for consideration of inclusion in future Zope versions.
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
-- John Goerzen Linux, Unix consulting & programming jgoerzen@complete.org | Developer, Debian GNU/Linux (Free powerful OS upgrade) www.debian.org | ----------------------------------------------------------------------------+ The 176,239,285th prime number is 3,697,131,523.
At 07:36 AM 9/9/99 -0500, John Goerzen wrote:
Excellent, this sounds like exactly what I need to fix. Can you send the patch along to me?
Not yet. I actually made it to an older version of DT_Let used at my company with an older version of DocumentTemplate, as our production apps are not yet upgraded to the latest DocumentTemplate. I will soon re-make the patches against the current DocumentTemplate version, and then they will be meaningful. My DT_Let won't work if you put it in the same DocumentTemplate directory as the other modules, at present. It's likely that I'll have something available next week.
participants (2)
-
John Goerzen -
Phillip J. Eby