#5422 closed (fixed)
Passing raw flag as an additional parameter to post_save & pre_save signals
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Keywords: | ||
Cc: | huddlej@…, jonathan.buchanan@… | Triage Stage: | Unreviewed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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.
Attachments (2)
Change History (8)
by , 17 years ago
Attachment: | save-send-raw-flag.diff added |
---|
comment:2 by , 17 years ago
Cc: | added |
---|
by , 17 years ago
Attachment: | save-send-raw-flag_v2.diff added |
---|
Updated patch against trunk and updated corresponding tests
comment:4 by , 17 years ago
Cc: | added |
---|
comment:5 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:6 by , 17 years ago
Noting that this change is backwards-compatible since django.dispatch.robustapply.robustApply
checks to see what arguments and keyword arguments the receiver accepts and only calls the receiver with those arguments.
Passes raw flag from save to pre_save & post_save signal handlers