I'm trying out Django 1.8b2, and am getting close to getting our main 
project's test suite passing. However I've run into this behaviour and I'm 
just curious whether anyone else has experienced it or has any thoughts. 

TransactionManagementError: An error occurred in the current transaction. 
> You can't execute queries until the end of the 'atomic' block.


Code to reproduce with command ./runtests.py m2m_signals
https://github.com/django/django/compare/stable/1.8.x...mathspace:m2m_atomic

The test (with a minor import merge conflict) can be rebased onto the 
stable/1.7.x <https://github.com/django/django/tree/stable/1.7.x> branch 
and passes there.

I think it's related to this documented change:
https://docs.djangoproject.com/en/dev/releases/1.8/#related-object-operations-are-run-in-a-transaction

We can fix it by catching the known instance of ProtectedError explicitly 
which we probably should be doing in our signal anyway.

But it's not clear if we can always catch ProtectedError for all possible 
protected relationships, and whether that could be a symptom of something 
that might affect more downstream code (like possibly different future 
requests to a Django app server with persistent DB connections... just a 
hypothesis?). Django's deep ORM internals are well out of my depth so if 
anyone can shed light on this (e.g. hopefully I'm completely wrong with my 
hypothesis), that would be appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b8807abc-54a7-4432-bd92-e34bed75a3c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to