[Zope] Syntax for dtml-in property check?

Dylan Reinhardt zope at dylanreinhardt.com
Fri Aug 15 04:37:24 EDT 2003


On Thu, 2003-08-14 at 18:44, Dan Shafer wrote:
> But I get an error from Zope indicating the public variable "sequence" 
> isn't defined? I'm in a <dtml-in> so I *believe* sequence should have 
> meaning. Am I wrong?

You're right, but not in a way that's helpful.  :-)

In a Python expression, "foo-bar" will evaluate as "foo minus bar" even
though there are no spaces around the minus operator.  Thus, the
"sequence-" variables get misinterpreted when you attempt to use them
inside a Python expression... which you are.

In this case you need to use the prefix attribute of the dtml-in tag. 
It replaces "sequence-" with "foo_" (note the underscore) where foo is
the value you assign to prefix.  

Example:

<dtml-in my_sequence prefix=seq>
   <dtml-var seq_item>
</dtml-in>

You'll also need prefix when you nest one loop inside another.  IMO, you
may as well use prefix all the time... it's easier than trying to figure
out when it will or won't apply.

HTH,

Dylan





More information about the Zope mailing list