Opened 5 years ago

Closed 5 years ago

#14106 closed (invalid)

Duplicate emails without fully qualified project imports

Reported by: tom_simpson Owned by: nobody
Component: Uncategorized Version: 1.2
Severity: Keywords:
Cc: tom@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


When sending emails via signals.

Emails become duplicated if you are not using fully qualified imports for your project.

{from app.models import ....} causes duplicate emails being sent.


{from import ....} seems to resolve the issue


Change History (2)

comment:1 Changed 5 years ago by tom_simpson

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

It seems that all signals are being called twice by the models, not just the email sending function.


comment:2 Changed 5 years ago by russellm

  • Resolution set to invalid
  • Status changed from new to closed

from import foo and from app.models import foo are two separate imports, resulting in two separate modules. As a result, if you have a signal registered in it causes two separate signals to be registered.

This is a language feature of Python; it isn't something that Django is in a position to fix.

That said, some of the discussions around the logging improvements under consideration for Django 1.3 may result in a better way to register signals, which will avoid this problem by providing a way to register signals that isn't prone to accidental duplication as a result of import paths.

Note: See TracTickets for help on using tickets.
Back to Top