[Zope] dtml-in iteration over a string.split

Curtis Maloney curtis@umd.com.au
Wed, 15 Mar 2000 10:32:31 +1100


On Wed, 15 Mar 2000, Daniel.Weber@SEMATECH.Org wrote:
> 
> I can't get this to work at all:
> <dtml-if "sequence-size > 1">
> zope complains about not being able to find 'sequence'.  I had solved this issue
> before with a let tag <dtml-let size=sequence-size>, but it seems very wasteful
> and adds a lot of syntax overhead to the code.  How can I access the sequence
> variable in an expression?

OK.. Two points.

Firstly, my appology.  I mistakenly believed sequence-size existed, since it's
previous- and next- counterparts do.  However, sequence-length aparently does.
(there is a reference to it in the ZQR, and it's also in the source code.)


Secondly, your problem stems from the fact that sequence-length is not a valid
variable name in Python.  you must use

<dtml-if "_['sequence-size'] > 1">

Annoying, yes... but that's the way somebody chose to go.  I don't know why,
but it's there.  In fact, if anyone could give me a good reason why it is this
way, I would be most appreciative.

-- 
Have a better one,
	Curtis.

<dtml-var standard_work_disclaimer>