Hi, Fiore,
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?
If you are really getting a string back that looks like that, you can make a sequence of it by the following expression: "_.string.split(thestring[1,-1],',')" This takes everything but the first and last elements of the string, getting rid of [ and ], then splits it into a list by the commas. But you have to get rid of the single quotes beforehand with "_.string.replace(thestring, _.chr(39), '')", chr(39) being "'", though you can't say that. So the entire expression would be "_.string.split(_.string.replace(thestring, _.chr(39), '')[1,-1],',')" hth -- Jim Washington