Passing raw flag as an additional parameter to post_save & pre_save signals
|Reported by:||graham.carlyle@…||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Cc:||huddlej@…, jonathan.buchanan@…||Triage Stage:||Unreviewed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Signal handlers attached to pre_save & post_save signals are called when data is loaded from a fixture. If these signal handlers attempt to query/modify other records in the database then they may have problems as the database might not yet be in a consistent state if the fixture hasn't completed loading.
Work resulting from ticket #4495 avoided the calling of a custom save method when loading fixtures to avoid this same problem.
By passing the raw flag as an additional parameter to the signal handlers their implementations could decide whether to do any work and so avoid data consistency problems when the raw flag is True.
This change is unlikely to cause problems with existing signal handlers as named arguments are only passed to handlers that have those as parameters.
Change History (8)
Changed 7 years ago by graham.carlyle@…
comment:1 Changed 7 years ago by graham.carlyle@…
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset