#27312: Current solution to prevent signals from executing on fixtures is non
ideal
-------------------------------+------------------------------
Reporter: Álex Córcoles | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.10
Severity: Normal | Keywords: fixtures signals
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------
We have some signals that create information when some models are
added/updated which should not be run when loading fixtures.
We have had to use the raw argument to disable each signal when fixtures
are being loaded, and it works, but it is not ideal as we have to repeat
the same bit of code in each affected signal (basically "if raw: return"),
which is duplicated code (which we do not like) and code we have to test
(which adds overhead- esp. as the code contains a conditional and messes
with coverage).
I think it would be better if you could state that you only want to
connect your signal for non-fixture operations- this way it would be 100%
declarative and not require any testing).
Other alternatives could be provided as not running signals on fixtures by
default, which I think it's a nicer default, but might be controversial.
--
Ticket URL: <https://code.djangoproject.com/ticket/27312>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.26fcd1d34f46b22e1090a6119d440d2b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.