Transactions

7 views
Skip to first unread message

Ben Ford

unread,
Nov 2, 2009, 11:27:00 AM11/2/09
to django-d...@googlegroups.com
Hi All,

I'm looking into the transaction module due to an app that I'm working
on doing something very odd (and mostly indefensible) with long
running transactions.

It would seem that the docs are totally off base WRT to transactions -
specifically the DISABLE_TRANSACTION_MANAGEMENT setting. I'm extremely
confused looking through the code as I can find no reference to this
setting anywhere in the code... ever. When magic removal branch was
merged (at revision 2809) the TRANSACTIONS_MANAGED setting appears in
global_settings.py, but I've followed back further than that.
Transactions seem to have first appeared in
http://code.djangoproject.com/changeset/2457 when the
TRANSACTIONS_MANAGED setting and a load of other transaction related
stuff was committed.

Ticket http://code.djangoproject.com/ticket/2304 (from July 06!)
refers to this so I'm posting here and reopening rather than opening
another similar ticket. I would suggest the best fix being changing
the transaction documentation to replace
DISABLE_TRANSACTION_MANAGEMENT with TRANSACTIONS_MANAGED.

My problem has come as the app isn't using the transaction middleware
and therefore _rollback_on_exception (in django.db.__init__) is being
fired by the got_request_exception signal, despite
DISABLE_TRANSACTION_MANAGEMENT being set. As expected from reading the
code when I replace it with TRANSACTIONS_MANAGED, the app behaves as
per the documentation

I'm really curious though -- can anyone remember far back enough to
know where this came from? I haven't been able to find a single
mention of DISABLE_TRANSACTION_MANAGEMENT anywhere in django's
history!


Cheers,
Ben

P.S. I'm fully aware that the way our app is working is causing our
problems, and that it should probably should be changed forthwith -
however it's being put into an existing infrastructure and there isn't
the freedom at this point to change it. Even with this being the case,
I think this could quite easily bite others, and it's pretty trivial
to fix.


--
Regards,
Ben Ford
ben.f...@gmail.com
+447540722690
Joan Crawford - "I, Joan Crawford, I believe in the dollar.
Everything I earn, I spend." -
http://www.brainyquote.com/quotes/authors/j/joan_crawford.html

Jacob Kaplan-Moss

unread,
Nov 2, 2009, 12:19:54 PM11/2/09
to django-d...@googlegroups.com
On Mon, Nov 2, 2009 at 11:27 AM, Ben Ford <ben.f...@gmail.com> wrote:
> I'm really curious though -- can anyone remember far back enough to
> know where this came from? I haven't been able to find a single
> mention of DISABLE_TRANSACTION_MANAGEMENT  anywhere in django's
> history!

I'm pretty sure this is a documentation issue -- I think
`DISABLE_TRANSACTION_MANAGEMENT = True` in the docs should just be
`TRANSACTIONS_MANAGED = False`.

Jacob

ben

unread,
Nov 2, 2009, 12:27:08 PM11/2/09
to Django developers
Isn't it TRANSACTION_MANAGE = True?

Ben

On 2 Nov, 17:19, Jacob Kaplan-Moss <ja...@jacobian.org> wrote:
Reply all
Reply to author
Forward
0 new messages