[Zope] replace values in a list or dictionary

TFE MMS JARVIS JOHN jarvis.sd082@ex.tel.co.jp
Mon, 31 May 1999 16:34:21 +0900


maybe you could do:

<!--#call "REQUEST.set('L',[1]+L[1:_.len(L)])"-->

this would create a new list with the first item being 1
and the rest being, well, the rest and replace the old list.

Pretty ugly, though...

BTW, I had a similar problem about 10 minutes ago 
with dictionaries. A solution I found:

<!--#call "REQUEST.mydict.update({'key':'value})"-->

HTH,
John Jarvis

> -----Original Message-----
> From:	T. C. Huang [SMTP:a00tch00@nchc.gov.tw]
> Sent:	Monday, May 31, 1999 4:11 PM
> To:	zope@zope.org
> Subject:	[Zope] replace values in a list or dictionary
> 
> Hi,
>   How can I replace the value in a list defined in REQUEST?
>   For example, in a DTML Document:
>   <!--#call "REQUEST.set('L',['a',2,3,4,5])"-->
>   How can I replace the value 'a' in list L with 1 so that L become
> [1,2,3,4,5]?
>   In Python, it's easy. L[0]=1. How can one do the same thing in Zope
> DTML Document?
> 
> T.C. Huang
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
> 
> (For developer-specific issues, use the companion list,
> zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )