Opened 7 months ago

Closed 7 months ago

#35372 closed Cleanup/optimization (wontfix)

Remove convenience imports in django/core/mail/__init__.py

Reported by: Danic Owned by: nobody
Component: Core (Mail) Version: 5.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

I found the following comment in django\core\mail\init.py

# Imported for backwards compatibility and for the sake
# of a cleaner namespace. These symbols used to be in
# django/core/mail.py before the introduction of email
# backends and the subsequent reorganization (See #10355)

#10355 relates to Django 1. As it's out of support, it maybe doesn't make sense to keep the backwards compatibility. Would it make sense to have a look at that file and check what of the code can be removed or if the comment should be updated?

Change History (2)

comment:1 by David Sanders, 7 months ago

I don't think we should remove these imports for a couple of reasons:

  1. Some of them are documented as being imported from django.core.mail, eg SafeMIMEText here: https://docs.djangoproject.com/en/5.0/topics/email/#emailmessage-objects
  2. There's no real harm in having some default imports? 🤔

If anything maybe we could remove the comment? 🤔

comment:2 by Tim Graham, 7 months ago

Description: modified (diff)
Resolution: wontfix
Status: newclosed
Summary: Obsolete code in django\core\mail\__init__.py ?Remove convenience imports in django/core/mail/__init__.py

The imports and comment look fine to me.

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