#25437: Translation of DEFAULT_FROM_EMAIL not working
--------------------------------+--------------------
Reporter: maciej-pawlisz | Owner: nobody
Type: Bug | Status: new
Component: Core (Mail) | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------
I tried to translate `DEFAULT_FROM_EMAIL` using `ugettext_lazy`.
Unfortunately it didn't work resulting in a traceback:
{{{
File "C:\Python27\lib\site-packages\django\core\mail\message.py", line
276, in send
return self.get_connection(fail_silently).send_messages([self])
File "C:\Python27\lib\site-packages\django\core\mail\backends\smtp.py",
line 94, in send_messages
sent = self._send(message)
File "C:\Python27\lib\site-packages\django\core\mail\backends\smtp.py",
line 105, in _send
from_email = sanitize_address(email_message.from_email,
email_message.encoding)
File "C:\Python27\lib\site-packages\django\core\mail\message.py", line
104, in sanitize_address
nm, addr = addr
ValueError: too many values to unpack
}}}
I think that there is a bug in `sanitize_address`:
{{{
def sanitize_address(addr, encoding):
if isinstance(addr, six.string_types):
addr = parseaddr(force_text(addr))
nm, addr = addr
}}}
`parseaddr` is never called because addr is not a `six.string_types`, but
a `django.utils.functional.__proxy__`. `force_text` should be called
before that check or if condition should be different, ie:
{{{
if not isinstance(addr,(tuple,list)):
addr = parseaddr(force_text(addr))
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25437>
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/057.4713c10356c3139a8756746f79826cb0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.