#9964: Transaction middleware closes the transaction only when it's marked as dirty ---------------------------------------------------+------------------------ Reporter: ishirav | Owner: mtredinnick Status: assigned | Milestone: 1.3 Component: Database layer (models, ORM) | Version: 1.0-beta-1 Resolution: | Keywords: transactions Stage: Accepted | Has_patch: 1 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---------------------------------------------------+------------------------ Comment (by jacob):
Hi Shai -- As I said on the mailing list (http://groups.google.com/group/django- developers/msg/3fe71024db4d32f6), let's go with the "bugfix" approach. I'm willing to deal with the backwards-compatibility concerns from anyone who's for some reason relying on read-only connections being left hanging. There are still a few problems with the current patch though: First, I'm deeply unhappy with the cursor wrapper approach. We're already wrapping the backend cursor objects, so this additional layer means there's at least two __getattr__ calls every time someone calls execute(). That's an unacceptable overhead both in terms of time and code complexity. I have the feeling that this whole thing can be greatly cleaned up since we've decided to basically unconditionally commit() automatically opened transactions. Perhaps we can just do it in BaseDatabaseWrapper.close()? I haven't thought that approach through entirely, so perhaps I'm missing something. But I *really* want a simpler approach here that doesn't introduce another layer of indirection. Second, the tests need some comments or explanation of what they're doing. There isn't a single comment or docstring in that file, and things like `Test9964.test_6669()` are terrible names for a test function. Someone needs to spend some time explaining what the tests are actually testing. I'll try to work on this stuff myself, too, but as you've been thinking about this for a lot longer you can probably do it more efficiently than me. Thanks for your good work so far. If we can get this nailed down pretty soon I'll make sure it gets into 1.3. -- Ticket URL: <http://code.djangoproject.com/ticket/9964#comment:43> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.