[Zope-dev] Minor bug in 'Let' tag; fix enclosed

Phillip J. Eby pje@telecommunity.com
Sun, 11 Jul 1999 12:50:43 -0500


When you use the new 'let' tag with a Python expression containing a syntax
error, the Let tag's __init__ method bombs with a NameError, because I
didn't sufficiently clean up the code I was cribbing from when I developed
it.  :)  I can't believe it's been in there all this time, but I guess I
don't make very many Python syntax errors in my #let tags.  :)

I also noticed that there were some typos in the 'Let.stx' file, as well a
few errors of fact and omission.  (E.g., newlines are NOT required between
arguments to #let.) Diffs for both files (against current CVS of
DocumentTemplate) follow:


Index: DT_Let.py
===================================================================
RCS file: /cvs-repository/Packages/DocumentTemplate/DT_Let.py,v
retrieving revision 1.3
diff -r1.3 DT_Let.py
137c137
<                                               tag)
---
>                                               'let')
Index: Let.stx
===================================================================
RCS file: /cvs-repository/Packages/DocumentTemplate/Let.stx,v
retrieving revision 1.1
diff -r1.1 Let.stx
20,24c20,26
<  The #let tag works like the #with tag, but is more flexible in that
<  it allows you to make multiple assignments, and allows you to chain
<  assignments, using earlier declarations in later assignments.  Notice
<  inthe ablove example, the 'result' variable is based on 'num' and
<  'index', both of which are assigned in the same #let expression.
---
>  The #let tag works like using a #with tag on a _.namespace()
>  object, but is more flexible in that it allows you to access
>  variables without using _[] notation, and also lets you use the
>  the results of earlier declarations in later assignments.
>  Notice that in the above example, the 'result' variable is based
>  on 'num' and 'index', both of which are assigned in the same
>  #let expression.
26,29c28,30
<  Syntacticly, each argument to be evalulated in the head of the let
<  tag must be seperated by a newline.  Enclosing an argument in double
<  quotes causes it to be evaluated by the DTML expression machinery.
<  Un-quoted arguments are referenced by name.
---
>  Enclosing an argument in double quotes causes it to be evaluated by
>  the DTML expression machinery.  Un-quoted arguments are referenced
>  by name.