moved to zope-dev
-----Original Message----- From: Bruno Mattarollo [mailto:brunomadv@ciudad.com.ar] Sent: Monday, November 29, 1999 12:12 PM To: zope@zope.org Subject: [Zope] raise from external method and rollback trans [Q] Importance: High
Hello,
I am developing an External Method that checks for several parameters to be passed and does a lot of insert/updates in an Oracle database... I have several "checkpoints" and when one fails I want to be able to do a raise and rollback all the open (uncommited) transactions, since the DCOracle is a Level 3 adapter, there is no problem, because the transaction mechanism from Zope is integrated. But know here comes my question: how do I rollback a transaction without doing a raise? I need to do this to server diferent error pages when an error ocurrs... I mean, I have to present for example a form with all the fields the user filled in, or if there was another error, present another form. I do not want to use the standard_html_error ...
Brian and I talked a bit about this and we don't think this should be provided to DTML, it could mess up assumptions about calling an 'abort' and then things happening after that, in it's current state zope might try to commit changes after you've called abort since it never expect application level logic to be called after the commit or abort point. I believe it works on the assumption that transactions are only rolled back on errors. Why not standard_html_error? You can catch any number of your own errors that you raise in your code with a <dtml-if> construct, just test the value of error_type and then call specific pages based on those errors. Note, it's not a good idea to call documents from an error handler that can raise errors! You have to be careful about that. -Michel