[Zope] Create a list using DTML.
David H
bluepaul at earthlink.net
Tue May 24 18:16:39 EDT 2005
Fernando Lujan wrote:
>
>>I think you are close. Change <dtml-if ids_test in ids_test> to
>><dtml-if "ids_test in ids_test"> ?
>>
>>
>
>It's working like IN over a string, e.g. the [5,61] will make selected
>the number 5,6 and 61.
>
><dtml-call "REQUEST.set('ids_test', '(' + id_test[1:-1] + ')')">
>
>Where id_test is the result of the database query wich return in this
>format: {1,2,3}. I modify it to a (1,2,3) and finally I try the
> <dtml-call "REQUEST.set('list', _.list(ids_test))">
>
>Following this api:
>
>list (sequence)
> Return a list whose items are the same and in the same order as
>sequence's items. If sequence is already a list, a copy is made and
>returned, similar to sequence[:]. For instance, list('abc') returns
>returns ['a', 'b', 'c'] and list( (1, 2, 3) ) returns [1, 2, 3].
>
>I need a integer-list, is it possible?
>
>
>
Fernando,
I'm rusty with DTML But I know you can get a list returned using
_.string.split(idstest,',')
But Id call a python script with idstest as a param, eg
<dtml-call "REQUEST.set('myList',pyMakeList( idstest ))">
Eg,
python
import string
idstest = '{1,2,3}' # test only is param
s = s[1:-1]
list = string.split(s,',')
return list
Good luck!
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20050524/0084ed55/attachment.htm
More information about the Zope
mailing list