[Zope-dev] manage_changeProperties in a loop

Casey Duncan cduncan@kaivo.com
Wed, 17 Jan 2001 08:46:31 -0700


Arno Gross wrote:
> 
> If I try your suggestion wiht _.getitem(_['sequence-item'])
> (If I remember well this was the first I tried).
> 
> <dtml-call "REQUEST.set('rangList','folder1;folder2;folder2')">
> <dtml-in " _.string.split(rangList,';')">
>    <dtml-with "_.getitem(_['sequence-item'])">
>     <dtml-let index=sequence-index>
>       <dtml-call "manage_changeProperties({'rang':index})">
>     </dtml-let>
>   </dtml-with>
> </dtml-in>
> 
> I get this error: File
> D:\packages\Zope\WEBSIT~3\lib\python\DocumentTemplate\DT_In.py, line 691, in
> renderwob     (Object:  _.string.split(rangList,';'))   File
> D:\packages\Zope\WEBSIT~3\lib\python\DocumentTemplate\DT_With.py, line 133, in
> render     (Object: _.getitem(_['sequence-item']))   File
> D:\packages\Zope\WEBSIT~3\lib\python\DocumentTemplate\DT_Util.py, line 337, in
> eval     (Object: _.getitem(_['sequence-item']))    (Info: _)
> 
> Still any hints. Thanks.

Try this:
<dtml-call expr="REQUEST.set('rangList','folder1;folder2;folder2')">
<dtml-in expr="_.string.split(rangList,';')">
	<dtml-let folder="_[_['sequence-item']]"
                  index="_['sequence-index']">
		<dtml-call expr="folder.manage_changeProperties({'rang':index})">
	</dtml-let>
</dtml-in>

Also, why are you passing the folder ids in a string like this? Where
are these names coming from, a form?

If so, there are ways to eliminate the whole string.split. Also, the
code would not need to be this complex if the objects themselves can be
passed instead of a delimited string of ids.
-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>