[Zope] Undo Python Script

Marco Mans MMans at gti-group.com
Fri Jan 23 05:00:43 EST 2004


Hello Zopers!
 
I'm currently writing a script that adds some ExtFiles and then execute
an external method.
Here's the script [Script1]:
 
context.data['0002']['folder1'].manage_addProduct['ExtFile'].manage_addE
xtFile(id='1', title='file1', file=file1)

context.data['0002']['folder1'].manage_addProduct['ExtFile'].manage_addE
xtFile(id='2', title='file2', file=file2)

context.data['0002']['folder1'].manage_addProduct['ExtFile'].manage_addE
xtFile(id='3', title='file3', file=file3)

context.runExternalMethod(params) 
return 'OK'
 
When the external method causes NO errors, the Extfiles are made. But
when the Extrenal method causes 
an error, zope shows up the standard_error_message and the ExtFiles are
not made.....
I then executed the script from another script [Script2]:
 
try:
  context.Script1()
except:
  return 'ERROR'
else:
  return 'OK!'
 
When Script1 causes an error (from the extrernal method) the extfiles
are made. Zope shows 'ERROR'.
Why does this happen. When I execute Script1 from Script2 without
try-except the extfiles are not made
when the script causes an error... 
What must i add to undo all actions made in Script1?
 
 
Thanks for the support!
 
Marco.
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20040123/f303d029/attachment.html


More information about the Zope mailing list