To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/948D5F1E-F86D-44A0-9EEA-F1E9A6A4A382%40pelme.se.
--
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-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.
--
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-develop...@googlegroups.com.
To post to this group, send email to django-d...@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.
On 18 janv. 2014, at 19:50, Carl Meyer <ca...@oddbird.net> wrote:I think this is the right approach. I would use that package. I support adding it to Django.
> Those interested in this feature may find django-transaction-hooks [1] useful. It is my attempt to implement the commonly-useful case (run some code after the current transaction successfully commits, providing the code wasn't registered during a savepoint which was later rolled back.) I think the API provided by django-transaction-hooks is actually better for that use case than transaction signals are, since it does the work of handling some situations correctly (savepoints, closed connections), which in the case of signals are left up to the signal receiver to handle (or more likely, not bother to handle.)
>
> Testing and feedback welcome. If this becomes widely used and seems to fill a need, I think there is a chance it could become part of Django core. (See #21803.)
Since it doesn’t do anything until after the transaction has successfully committed, it cannot interfere with the transaction management code. That’s my most important requirement and the reason why I’m so strongly opposed to pre-commit/rollback signals.
If you look at the first email in this thread, the use case is “do something when a transaction is committed successfully”. In the later email that gives an example, it only uses post_commit. Generic transaction signals look like a collective hallucination to me, or at least a pretty bad case of YAGNI.
--
Aymeric.
On 18 janv. 2014, at 19:50, Carl Meyer <ca...@oddbird.net> wrote:
> Those interested in this feature may find django-transaction-hooks [1] useful. It is my attempt to implement the commonly-useful case (run some code after the current transaction successfully commits, providing the code wasn't registered during a savepoint which was later rolled back.) I think the API provided by django-transaction-hooks is actually better for that use case than transaction signals are, since it does the work of handling some situations correctly (savepoints, closed connections), which in the case of signals are left up to the signal receiver to handle (or more likely, not bother to handle.)
>
> Testing and feedback welcome. If this becomes widely used and seems to fill a need, I think there is a chance it could become part of Django core. (See #21803.)
I think this is the right approach. I would use that package. I support adding it to Django.