Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#23253 closed Bug (worksforme)

"MANAGERS" setting doesn't correctly process the value, if it is given as described in the documentation

Reported by: angry.kustomer@… Owned by: nobody
Component: Core (Mail) Version: 1.6
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

Django 1.6.5
According to the docs (https://docs.djangoproject.com/en/1.6/ref/settings/#managers) MANAGERS expects a tuple
of the same format as for ADMINS, that is tuple of tuples.
In the practice it crashes with an error:

PATH_TO_MY_VIRTUAL_ENV/lib/python3.4/site-packages/django/core/mail/message.py", line 244, in message

msgTo = self.extra_headers.get('To', ', '.join(self.to))

TypeError: sequence item 0: expected str instance, tuple found

That is system currently expects it to be a tuple of strings, not other tuples. If given so, everything works fine.

Change History (2)

comment:1 by Baptiste Mispelon, 10 years ago

Resolution: worksforme
Status: newclosed

Hi,

What code is triggering this error (can you also provide the full traceback)?

Using the example from the documentation, I can't reproduce your error (I tried on master and on 1.6):

# settings.py
ADMINS = (('John', 'john@example.com'), ('Mary', 'mary@example.com'))
MANAGERS = ADMINS

# test.py
from django.core.mail import mail_managers, mail_admins
mail_managers('test', 'test')
mail_admins('test', 'test')

I'm closing this as worksforme. Can you please reopen with the full traceback?

Thanks.

comment:2 by anonymous, 10 years ago

My bad, sorry. Looks like a minor difference in function parameters.
I'm using send_mail() and it expects list of strings, it cannot just take MANAGERS instead.
Thank you.

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