[Zope] Extreme DTML fun: How to copy a dtml-document while saving its properties

Fiore Basile fiore@alet.it
Sat, 1 Apr 2000 11:07:15 +0200


Hi,

this is my code for copying a dtml document found in a ZClass product folder/
subfolder to an instance folder of my choice, this is done inside a folder
creation routine.

 <dtml-in "defaultblocks.objectIds( 'DTML Document' )">
  <dtml-let si=sequence-item>
   <dtml-with newRoot>
     <dtml-call "manage_addDTMLDocument( si, '', defaultblocks[ si ] )"> 
     <dtml-in "defaultblocks[si].propertyIds()">
      	<dtml-if "not _['sequence-item']=='title'">
	<dtml-call "newRoot[si].manage_addProperty(
			_['sequence-item'],
			defaultblocks[si].getProperty(_['sequence-item']),
			defaultblocks[si].getPropertyType(_['sequence-item'])
			)">
	</dtml-if>
     </dtml-in> 
   </dtml-with>
  </dtml-let>
 </dtml-in>

But a problem occurs when a property is of type "lines", in that case the 
source value for ex.

Test
-
Test1
Test2
Test3

get translated in the destination document as aproperty of type
lines but with value

['Test', '-', 'Test1','Test2','Test3']

so i can't iterate over it with dtml-in tag.

I guess a solution could be to reparse the string in a tuple object for example
with an eval (I didn't find that in the zope namespace)

Any idea?

Thanks in advance for a reply

Fiore Basile  
<fiore@alet.it>
- AleT Net - 
Tel. +390503160000
Fax +390503161569