[Zope] Lines property slicing

Kevin Dangoor kid@kendermedia.com
Wed, 18 Aug 1999 14:57:35 -0400


-----Original Message-----
From: Jason Spisak <webmaster@mtear.com>
To: zope@zope.org <zope@zope.org>
Date: Wednesday, August 18, 1999 2:35 PM
Subject: [Zope] Lines property slicing


>I am trying to put a value into a particular line in a lines property.
>I thougt python list syntax would work like so:
>
>   <!--#call "propertysheets.properties.manage_changeProperties(
>              availability[0]=REQUEST['availability'])"-->

Untested... I'm assuming your lines property is called "availability". Let's
make the form variable called "newAvLine".

<dtml-call "REQUEST.set('availability', [newAvLine] + availability)">
<dtml-call ""propertysheets.properties.manage_changeProperties(REQUEST)">

This is specifically if you want to add an item to the beginning of the
list. I think you'll have to do trickery with slices in order to put
something in the middle...

(something like
<dtml-call "REQUEST.set('availability', availability[0:i] + newAvLine +
availability[i:]">

I don't think you can really do any kind of variable assignments in DTML
other than REQUEST.set.

Kevin