RE: how do I show the contents of a sub folder using the dtml-in tag?
Mea culpa: it works fine if I use letters - I had used a number for the ID of the subfolder (I thought it was allowed), which was leading to when I tried to save the changes: Document Template Parse Error Expression (Python) Syntax error: invalid syntax , for tag <dtml-in "2001.objectValues(['Folder'])">, on line 6 of index_html) Thanks a lot for your help! Cordialement, Nicolas VION Direction de la Communication LDCOM Networks - 1, Square Chaptal - 92309 Levallois Cedex Tél: +33 (0) 1 58 63 19 58 - Fax: +33 (0) 1 58 63 10 60
-----Message d'origine----- De: Casey Duncan [SMTP:c.duncan@nlada.org] Date: lundi 19 novembre 2001 18:26 À: Vion, Nicolas; 'zope@zope.org' Objet: Re: [Zope] how do I show the contents of a sub folder using the dtml-in tag?
On Monday 19 November 2001 11:38 am, Vion, Nicolas allegedly wrote:
I have a folder called alpha containing a folder subalpha. In a DTML document within alpha I want to list the contents of subalpha using objectValues.
Basically I would like to use something like <dtml-in "PARENTS[0].objectValues(['Folder'])">, but going DOWN instead of UP...
I haven't found anything in the various newsgroups (except for <dtml-in "subalpha.objectValues(['Folder'])">, which does not work...).
That is however, correct. What is the result? Do you want to show all contents or just folders? If you want all contents try:
<dtml-in "subalpha.objectValues()">
Thanks in advance for any help.
/---------------------------------------------------\ Casey Duncan, Sr. Web Developer National Legal Aid and Defender Association c.duncan@nlada.org \---------------------------------------------------/
On Monday 19 November 2001 12:50 pm, Vion, Nicolas allegedly wrote:
Mea culpa: it works fine if I use letters - I had used a number for the ID of the subfolder (I thought it was allowed), which was leading to when I tried to save the changes: Document Template Parse Error Expression (Python) Syntax error: invalid syntax , for tag <dtml-in "2001.objectValues(['Folder'])">, on line 6 of index_html)
Thanks a lot for your help!
Right, that has to do with the Python interpreter, which is where you are inside expr="...". Python variable names must start with a letter. However, you can get around this by using getitem as in: <dtml-in expr="_.getitem('2001').objectValues(['Folder'])"> This also works good if the id contains spaces, periods, dashes or any other character that is not legal in a Python variable name. happy Zoping! /---------------------------------------------------\ Casey Duncan, Sr. Web Developer National Legal Aid and Defender Association c.duncan@nlada.org \---------------------------------------------------/
participants (2)
-
Casey Duncan -
Vion, Nicolas