[Zope] Variable substitution of <dtml-in> Attributes

Danny William Adair danny@adair.net
Tue, 6 Nov 2001 19:04:13 +1300


> This doesn't appear to be possible but I'm just confirming. I have this
> line of code:
>
> <dtml-in expr="PARENTS[0].objectValues('Folder')" sort=id>
>
> I'd like to be able to substitute the Attributes as a string. For
> example a dtml method called sort_order may contain the string:
>
> reverse sort=id
>
> Then I would substitute that in at runtime. It might look something like
> this:
>
> <dtml-in expr="PARENTS[0].objectValues('Folder')" &dtml-sort_order;>
>
> However this and similar attempts gives me a Document Template Parse
> Error.

This is definitely not possible with the current dtml-in tag.
The dtml-tag does not provide "reverse_expr=", "sort_expr=", and so forth 
(like to the dtml-tree tag).

I see two options for you:

a) Use the new code from "lib/python/DTMLTemplate/sequence", and pass the 
"untouched" sequence

(see http://www.zope.org/Members/michel/ZB/AppendixA.dtml - "sequence - DTML 
Sequence Functions")

b) use a python script :-)

hth,
Danny