On 11 janv. 2014, at 11:05, Andrey Antukh <n...@niwi.be> wrote:

> In my opinion, "the default case are solved with atomic block" seems to be a 
> workaround instead of a solution.

As a short reminder, we’re talking about inconsistencies that arise when:

1) you do something in the database;
2) you do something related in another system — send an email, enqueue a task, 
cache a value;
3) the database transaction is rolled back, canceling the effects of 1) but not 
those of 2).

I may have been unclear when I closed the ticket. I’m not saying that atomic 
blocks solve the problem. I’m saying that the problem doesn’t happen in 
autocommit mode, which is the default in Django >= 1.6.

If you’re using transactions (i.e. ATOMIC_REQUESTS or atomic blocks), you may 
encounter the problem. But then I’m positive that transaction signals aren’t 
the solution. 

> I understand that signals in general are evil and register global callbacks 
> is not a very good solution, but I think, that a orm should give some generic 
> facility to attach code to execute when a transaction is successfully 
> committed or rolled back.

I’m not having this argument once more, so, there you go:
https://github.com/aaugustin/django-transaction-signals
https://pypi.python.org/pypi/django-transaction-signals-do-not-use

You may also be interested in:
https://github.com/davehughes/django-transaction-signals
https://pypi.python.org/pypi/django_transaction_signals

(The name conflict is unfortunate; I didn’t check before writing my package; at 
least that forced me to include a warning in the name.)

Jokes aside, transaction signals are just a (wrong) means to an (legitimate) 
end. I’ve documented the solutions I’m aware of:
https://github.com/aaugustin/django-transaction-signals#alternatives

Additional ideas welcome!

-- 
Aymeric.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/989FB6EA-12A2-4D54-9821-FB8473F3AF29%40polytechnique.org.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to