Hi, Andrei

I think I have it figured out.  I just submitted something similar to
the Collector about an analogous problem I have been having with 'lines'
properties.

When you create your tokens property, you should make its value a
string, like:

'1 2 3'

not a list: [1, 2, 3]

If your data is in a list and you want to use that list as tokens, you
need to join the list into a string first:

mylist = ['1', '2', '3']
fortokens = string.join(mylist,' ')

That's the python, but you can do it in DTML using _.string.join(.  Be
careful to convert your integers to strings first.

What's happening to you is that the string representation of the list,
"[1, 2, 3]" is getting stored verbatim as your tokens property, and
ZPublisher/Converters.py is then splitting it on the spaces when you ask
for it. Which is how you get that weird '[1,' '2,' '3]'.

-- Jim Washington

Andrei Belitski wrote:
> 
> Hi!
> 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'
> How can I get Zope to interpret my property like a list not a string or
> whatever else?
> Thank you in advance!
> 
> _______________________________________________
> 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 )

-- 

Jim Washington
Center for Assessment, Evaluation and Educational Programming
Department of Teaching and Learning, Virginia Tech

_______________________________________________
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 )

Reply via email to