[Zope] <!--#local--> and <!--#set--> (was Re: Proper way to set variables)

John Goerzen jgoerzen@complete.org
09 Sep 1999 07:36:55 -0500


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.