sequence-item: how do I use it in an expr?
I know I ask a lot of silly questions, at least I'm learning...In the following snippet 'build' is a list of integers. Now I want to do 'prBuildInsertMethod' with all the values in 'build'. To the untrained eye, it seems like this should work. But Zope can't find variable 'sequence'...why? How do I do it then? <dtml-in builds> <dtml-call expr="prBuildInsertMethod(buildNo=sequence-item)"> </dtml-in>
Gerrie Roos wrote:
I know I ask a lot of silly questions, at least I'm learning...In the following snippet 'build' is a list of integers. Now I want to do 'prBuildInsertMethod' with all the values in 'build'. To the untrained eye, it seems like this should work. But Zope can't find variable 'sequence'...why? How do I do it then?
<dtml-in builds> <dtml-call expr="prBuildInsertMethod(buildNo=sequence-item)"> </dtml-in>
this is a faq; the mailing list archives are a good resource for questions like these. That said: inside an expression sequence-item is interpreted as Python: sequence minus item, so you have to escape it <dtml-call expr="prBuildInsertMethod(buildNo=_['sequence-item'])"> this is ugly. You may want to consider using a Python script, where you can loop with for item in builds: context.prBuildInsertMethod(item) assuming that prBuilInsertMethod would also be a Python Script (for DTML Methods a few additional tricks may be necessary hth Rik
Because its trying to take sequence away from item. Try: <dtml-in builds> <dtml-call expr="prBuildInsertMethod(buildNo=_['sequence-item'])"> </dtml-in> ...and add yourself to the list of people who wonder why we cant have sequence_item. ----- Original Message ----- From: "Gerrie Roos" <gerrie@trispen.com> To: <zope@zope.org> Sent: Wednesday, April 04, 2001 7:38 AM Subject: [Zope] sequence-item: how do I use it in an expr?
I know I ask a lot of silly questions, at least I'm learning...In the following snippet 'build' is a list of integers. Now I want to do 'prBuildInsertMethod' with all the values in 'build'. To the untrained eye, it seems like this should work. But Zope can't find variable 'sequence'...why? How do I do it then?
<dtml-in builds> <dtml-call expr="prBuildInsertMethod(buildNo=sequence-item)"> </dtml-in>
_______________________________________________ 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 )
participants (3)
-
Andy -
Gerrie Roos -
Rik Hoekstra