Try:
<tr><td class="1"><dtml-var "_['sequence-item'][0]"></td></tr>
<tr><td class="1"><dtml-var "_['sequence-item'][1]"></td></tr>
Hope this helps!
Jean-François Ménard
Intranet DPAS
Pratiques d'affaires et orientations
* (514) 840-3000 poste 3939
* (514) 840-5585
* menard.jean-francois@hydro.qc.ca
* 855 Ste-Catherine est, 6e étage
Montréal, Qué. H2L 4P5
-----Message d'origine-----
De : Dunigan, Craig [mailto:craig.dunigan@esker.com]
Envoyé : jeudi 19 avril 2001 15:01
À : 'zope@zope.org'
Objet : [Zope] Can dtml-in iterate over a list of lists?
I have a Python script called "listArticles" that accepts a sort parameter
called "EWSortOrder," and returns a sorted list of lists. I would like to
display the list of lists using a DTML method called "ArticleList" that
looks something like this:
<table>
<dtml-in expr="listArticles(EWSortOrder)">
<tr><td class="1">sequence-item[0]</td></tr>
<tr><td class="2">sequence-item[1]</td></tr>
....
</dtml-in>
</table>
where sequence-item is obviously the list in the current iteration, but
clearly Zope isn't recognizing it as a list:
Error Type: KeyError
Error Value: sequence-item[0]
Traceback (innermost last):
File /opt/Zope/ZopeInst/lib/python/ZPublisher/Publish.py, line 222, in
publish_module
File /opt/Zope/ZopeInst/lib/python/ZPublisher/Publish.py, line 187, in
publish
File /opt/Zope/ZopeInst/lib/python/Zope/__init__.py, line 221, in
zpublisher_exception_hook
(Object: CatalogAware)
File /opt/Zope/ZopeInst/lib/python/ZPublisher/Publish.py, line 171, in
publish
File /opt/Zope/ZopeInst/lib/python/ZPublisher/mapply.py, line 160, in
mapply
(Object: ArticleList)
File /opt/Zope/ZopeInst/lib/python/ZPublisher/Publish.py, line 112, in
call_object
(Object: ArticleList)
File /opt/Zope/ZopeInst/lib/python/OFS/DTMLMethod.py, line 189, in
__call__
(Object: ArticleList)
File /opt/Zope/ZopeInst/lib/python/DocumentTemplate/DT_String.py, line
538, in __call__
(Object: ArticleList)
File /opt/Zope/ZopeInst/lib/python/DocumentTemplate/DT_In.py, line 711, in
renderwob
(Object: listArticles(EWSortOrder))
File /opt/Zope/ZopeInst/lib/python/DocumentTemplate/DT_Var.py, line 276,
in render
(Object: sequence-item[0])
KeyError: (see above)
Can I do this, and if so, how can I let dtml-in know to expect a list each
time? I can't nest dtml-in's because each item in the sub-list is processed
a little differently.
Craig Dunigan
Web Programmer
Esker Software - Extending the Reach of Information
mailto:craig.dunigan@esker.com
Ph. 608.273.6000
Fax 608.273.8227
http://www.esker.com
_______________________________________________
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 )