[Zope] Committing transaction by hand

Dieter Maurer dieter at handshake.de
Sun Aug 8 16:38:25 EDT 2004


Maciek Pasternacki wrote at 2004-8-8 05:18 +0200:
> ...
>    get_transaction().commit()
>    self.Cart().ThrowIn(self.REQUEST)
>
>It seems to work for now but I'm not really sure if such messing with
>something usually done automagically by Zope won't have some obscure
>and nasty side effects.  Am I doing something dangerous now or is this
>the Right Way to deal with my problem and if it's not then what is?

In general, it is not a good idea to explicitly commit a transaction:

  If after the "commit" a "ConflictError" occurs (which is not
  that unlikely when you modify the ZODB), then the
  publisher will retry the requests.
  This means that the transaction you already committed
  is performed again.

In your case, this may not make a problem, though.

-- 
Dieter


More information about the Zope mailing list