Andrei Belitski writes:
> I add a list property to a DTML document of type 'tokens' (e.g. '[1, 2,
> 3]') wenn i try to retrieve it with _.getitem i get '[1,' '2,' '3]'
> instead of '1' '2' '3'
Are you sure, it was '[1,' '2,' '3]' and not ['1', '2', '3', '4']?
If it were, it would be really strange, unbelievable.
['1', '2', '3', '4'] would be normal, when you use
a list (it definitely is one!) in e.g.:
<dtml-var "_.getitem('toks')">
as a list (of cause) can not be part of a generated HTML page.
It must be converted into a string. And the above
it the string representation of a list.
To get the representation, you seem to favour (though
I do not understand why), you could use:
<dtml-var "_.str(_.getitem('toks'))[1:-1]">
This make the string conversion explicitly ("_.str")
and then keeps the slice "[1:-1]" which means
everything beside the first and last character,
i.e. you chop the '[]'.
Dieter
_______________________________________________
Zope maillist - [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope-dev )