#22734: Move SMTP / email settings to a dictionary
-------------------------------------+-------------------------------------
     Reporter:  jwa                  |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |                  Version:  master
    Component:  Core (Mail)          |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:  settings, email,     |      Needs documentation:  0
  mail, smtp                         |  Patch needs improvement:  1
    Has patch:  1                    |                    UI/UX:  0
  Needs tests:  1                    |
Easy pickings:  0                    |
-------------------------------------+-------------------------------------
Changes (by loic84):

 * cc: loic84 (added)


Comment:

 `OPTIONS` would be consistent with what we have for `DATABASES`: +1 over
 `BACKEND_OPTIONS`.

 `dict` composability can be a bit of a pain point as demonstrated by
 logging's `dictConfig`, but for SMTP I'd say we can get away with updating
 the defaults with what's found in `OPTIONS`.

 {{{#!python
 class EmailBackend(BaseEmailBackend):
     def __init__(self, host=None, port=None, **kwargs):
         options = settings.EMAIL.get('OPTIONS', {})
         self.host = host or options.get('HOST', 'localhost')
         self.port = host or options.get('PORT', 25)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22734#comment:17>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.b13507f1174faff8446a1052a5190f8d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to