Frank Burkhardt wrote:
> Hi,
> when I raise an exception in a view, no changes done to the any object
> are saved to zodb.
> I would like to change that for a single object:
> class MyView(BrowserView):
>    def __call__(self):
>       [...]
>       if some_test:
>          save_object(self.context)
>          raise MyException()
>       [...]
> No other object should be saved - just self.context. How could I do that?

You can do this by explicitly rolling back the current transaction,
modifying that single object and committing the transaction so that just
those changes will be saved. Then you raise the exception and let Zope
do its things (which, among others, include rolling back the now pretty
much empty transaction).



Zope3-users mailing list

Reply via email to