[Zope] another "issue.1999.01"-Problem

Martijn Pieters mj@antraciet.nl
Sat, 11 Sep 1999 18:08:43 +0200


At 17:43 11-9-99 , Tom Schwaller wrote:
>well, here another problem I'm fighting with:
>
><dtml-with "_.getattr(_.getattr(issue, '1998'), '01')"> or
><dtml-with issue><dtml-with 1998><dtml-with 01>
>
>works perfect, but now I want to get the string Wo="issue.1998.01"
>from an input-field and go to the corresponding subfolder (always
>begining from the top)
>
><dtml-in "_.string.split(Wo, '/')">
><dtml-if sequence-start>
><dtml-call "REQUEST.set('Wo', _.getattr(PARENTS[-1], sequence-item))">
><dtml-else>
><dtml-call "REQUEST.set('Wo', _.getattr(Wo, sequence-item))">
></dtml-if>
></dtml-in>
>
>gives
>
>  File
>/home/src/Python/Zope-2.0.0-src/lib/python/DocumentTemplate/DT_Util.py,
>line 321, in eval
>     (Object: REQUEST.set('Wo', _.getattr(PARENTS[-1], sequence-item)))
>   File <string>, line 0, in ?
>NameError: (see above)
>
>Wo="News" as input for
>
><dtml-call "REQUEST.set('Wo', _.getattr(PARENTS[-1], Wo))">
>
>works as expected. Is sequence-item not a string in the above example?

sequence-item is two variables in Python: sequence minus item. Use 
_['sequence-item'] instead.

--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| T: +31 35 7502100 F: +31 35 7502111
| mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
---------------------------------------------