[Zope] Re: how do I show the contents of a sub folder using the dtml-in tag?

Casey Duncan c.duncan@nlada.org
Mon, 19 Nov 2001 13:15:46 -0500


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
\---------------------------------------------------/