[Zope] Pass <dtml-var sequence-item> as parameter to External Method

Tino Wildenhain tino at wildenhain.de
Wed Oct 19 10:49:27 EDT 2005


...
>>which is the quick & dirty variant, or:
>><dtml-var expr="(_['sequence-item'] or 
>>"").decode('iso-8859-7').encode('utf-8')" >
>>
>>Which uses a "boolean trick".
>>
>>HTH
>>Tino
>>
>>PS: get used to python scripts where this is a lot better
>>to write
> 
> 
> I agree with you and i would write this in python script (if this was
> not an emegerncy and i was not a niewbie)
> There one more thing to solve. Not all my elements in the list are
> strings. If i was writing python i would use
> for i,elem in enumerate(data):
>     for j,ele in enumerate(elem):
>         if isinstance(ele,(str,unicode)):
>             print unicode(ele,'iso-8859-7').encode('utf-8')
> what is the corresponding dtml-if to check if sequence-item is a
> string?

there is same_type to check. But you could just do:

<dtml-var expr="str(_['sequence-item'] or 
"").decode('iso-8859-7').encode('utf-8')" >

basically turn everything into a string.



More information about the Zope mailing list