On 10 Sty, 02:38, apramanik <abh...@gmail.com> wrote: > Thanks! That partially fixes my problem. I wrapped a function with > commit_on_success and it doesn't rollback the changes if it throws an > IntegrityError coming from PostgresSQL: > > @transaction.commit_on_success > def add_destination( self, placemark, trip, user, > \ > description = None, status = > Item.SUGGESTED ) : > > ... > > # create the > destination > destination = self.create(creator = user, description = > description, > status = status, location = location, trip = > trip) > > ... > > So, if that create throws an IntegrityError, the transaction is *not* > rolled back. If I place "transaction.set_dirty()" before the create, > the transaction is rolled back. Seems like a bug. >
I'm not that sure - if there is fresh transaction and first statement in it is INSERT, and that insert fails, then the transaction is still empty - so there is nothing to be rolled back. -- Tomasz Zielinski http://pyconsultant.eu
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.