David Siedband wrote at 2004-7-29 14:48 -0700:
I have a DTML method 'resource_xml' that produces an XML file. I'm want to apply this method to the records returned by a zSQL 'selectExportDocs' and save each the XML for each one.
<dtml-call "REQUEST.set('file_type', 'text/xml' )"> <dtml-in "queries.selectExportDocs()"> <dtml-in "resource_xml()"> <dtml-call "this().manage_addFile(REQUEST['id'], file, REQUEST['title'])"> </dtml-in> </dtml-in>
This definitely looks quite wrong... Remember that "dtml-in" is a loop construct. This means you have two nested loops where the inner body always creates the same file. Strong recommendation: use a Python Script (and not a DTML object) to code such "logic". Almost surely, in your Python Script, you will have something like req = container.REQUEST context.manage_addFile(req['id'], context.resource_xml() ) I expect that the SQL call is best done inside "resource_xml". Should this not be the case, then you must think about how the query result affects "resource_xml". You can pass them into "resource_xml" via keyword (!) arguments, e.g. context.manage_addFile( req['id'], context.resource_xml(context.queries.select...()) ) -- Dieter