[Zope] Transactions

Jacob Lundqvist jaclu@galdrion.com
Thu, 10 Aug 2000 10:00:39 +0200


Hi Kapil Thangavelu!
I dont  know of if this is what your after, but here is one way do do
transacts with / without rollback


One simple way of having rollback is to do it with except raising a
flag, then 
if the flag gets turned on do whatever is needed to undo the current
action
this can be done recursivly, to rollback a whole sequence of actions

rollback=0
try:
  [do stuff foo]
  try:
    [do stuff bar]
  except:
    rollback=1
  if rollback:
    [rollback bar]
except:
  rollback=1
if rollback:
  [rollback foo]   




> hmmm... related question (i think) how does one make a method whose
> effect can't be rolled back?

try:
  [do stuff foo]
   
  [do stuff bar]
except:
  pass


	/Jacob Lundqvist