[Zope] sequence-item and ""

Rob Miller rob-at-kalistra-dot-com@kalistra.com
Tue, 18 Jul 2000 20:30:52 GMT


Diego Rodrigo Neufert writes:

> Hi ppl...
> 
> Why I cant use dtml-var "sequence-item">??

Because, as I understand it, anything within "" gets treated as Python code
by the DTML interpreter.  Thus "sequence-item" is parsed as an expression:
sequence _minus_ item.  A dash is not a valid variable name character in
Python, but it is in DTML; this is unfortunate.

> 
> Every time I try to access sequence-item under "" in a dtml-call dtml-var or
> anything else I got this error:
> 
> Error Type: NameError
> Error Value: sequence
> 
> Well, I found a solution:
> <dtml-let si=sequence-item>
> <dtml-var "si">
> </dtml-let>
> Now everything is ok... but I dont want to do this, I want to access the
> *&@%$#@& sequence-item in "".

I've searched through the list archives and come to the conclusion that
your solution above is the cleanest way to handle this, for now.  There are
other ways, but they involve ugly-looking permutations of the "_" namespace
variable, and they approach the splendor of Perl in their readability.  The
"right" solution, IMHO, would be to rename the "sequence-..." variables to
a different set of names that doesn't cause the Python interpreter to
choke.  I seem to recall someone saying that this (or something similar)
was being worked on, but, alas, for now <dtml-let> is our best option.

rob

> 
> Can anyone help me?
> 
> -----------------------------
> Diego Rodrigo Neufert
> -webmaster
> ---------------------------
> (Magic Web Design)
> (email) (diego@magicwebdesign.com.br)
> (curitiba) (pr)
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>