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. Abhik On Jan 9, 4:57 pm, Karen Tracey <kmtra...@gmail.com> wrote: > On Sat, Jan 9, 2010 at 7:06 PM, apramanik <abh...@gmail.com> wrote: > > Hey all, > > > I am seeing transactions wrapping my views without using the > > 'django.middleware.transaction.TransactionMiddleware'. I don't have > > any @transaction decorators around my view. I also tried setting > > DISABLE_TRANSACTION_MANAGEMENT to True as per: > >http://docs.djangoproject.com/en/1.1/topics/db/transactions/and that > > didn't change anything. Where are these mysterious transactions being > > set up from? The seem to be happening before the session is being > > pulled for the view's request. I'm using Django 1.1 and PostgresSQL. > > Thanks! > > I think the transaction you are seeing is the one referred to at the top of > that page: > > Django’s default behavior is to run with an open transaction which it > commits automatically when... > > That doc note on disabling transaction management appears to be incorrect. > There's a ticket open on that:http://code.djangoproject.com/ticket/2304. I > do not know the history of that setting. Given the wording of the doc for > it, it might be that at some point it was decided to be a Bad Idea and > removed, yet the doc was left around, but that is speculation on my part. > > Note if you read all the way to the bottom of the page there is a note about > using database-level autocommit on sufficiently high levels of PostgreSQL. > That may be what you are looking for. > > Karen
-- 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.