Changes between Initial Version and Version 6 of Ticket #23641


Ignore:
Timestamp:
Oct 13, 2014, 12:05:44 PM (10 years ago)
Author:
Wojtek Ruszczewski
Comment:

Cleaned up and rebased branch moving the post_migrate signal registration for auth, contenttypes and sites to ready and adding two notes to the docs (in short: -- registering signals in ready may require a dispatch_uid, -- signals using app config as a sender should only be registered in ready). I may be overdoing the documentation, so please consider if it wouldn't be better to just skip the notes.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #23641

    • Property Triage Stage UnreviewedAccepted
    • Property Has patch set
  • Ticket #23641 – Description

    initial v6  
    33The signal dispatcher stores `id()` of the  sender argument provided to `connect` to identify the sender that we're interested in receiving the signals from, in case of `post_migrate` signals this is often an id of an `AppConfig` for the registering app. When `set_installed_apps` is called it reinstantiates all app configs. If afterwards you send a signal using app config from the global app registry as the sender (as is the case in `emit_post_migrate_signal` when setting up test databases), its id won't match the one stored by the dispatcher, thus signal handlers won't get executed.
    44
    5 [https://github.com/wrwrwr/django/tree/fix/missing-default-site-with-set-installed-apps A branch] with an example test case and a possible partial fix (that in full would be moving all module-level signal registration to `AppConfig.ready`).
     5[https://github.com/wrwrwr/django/compare/ticket_23641 A branch] with an example test case and a possible fix.
    66
    77[https://github.com/wrwrwr/mezzanine/blob/maintenance/1.8-discover-test-runner/mezzanine/utils/tests.py#L117 A sketch] of a possible more general solution / workaround (this Mezzanine wrapper for `DiscoverRunner` turned out pretty involved, you're welcome to suggest a cleaner implementation :-)
Back to Top