Opened 14 years ago

Closed 13 years ago

Last modified 12 years ago

#13494 closed (fixed)

Bad default for EMAIL_SUBJECT_PREFIX

Reported by: Henrique C. Alves Owned by: Andi Albrecht
Component: Core (Mail) Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The 'EMAIL_SUBJECT_PREFIX' setting is, by default, a string. This makes it break loud and needlessly if you pass a translation as the subject to 'mail_managers()':

TypeError 
cannot concatenate 'str' and '__proxy__' objects

The culprit line of django/core/mail.py:

 424. EmailMessage(settings.EMAIL_SUBJECT_PREFIX + subject, message, ...

Seems like an easy fix (just change the default setting to unicode?).

Attachments (2)

bug13494.diff (2.4 KB ) - added by Andi Albrecht 13 years ago.
bug13494.2.diff (2.3 KB ) - added by Andi Albrecht 13 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by Ramiro Morales, 14 years ago

milestone: 2.0

A couple of workarounds could be wrapping your translatable subject with a call to call unicode() before passing it to mail_managers() or using string_concat().

comment:2 by Russell Keith-Magee, 14 years ago

Triage Stage: UnreviewedAccepted

by Andi Albrecht, 13 years ago

Attachment: bug13494.diff added

comment:3 by Andi Albrecht, 13 years ago

Has patch: set

comment:4 by Andi Albrecht, 13 years ago

Owner: changed from nobody to Andi Albrecht
Status: newassigned

comment:5 by Jannis Leidel, 13 years ago

milestone: 1.3

by Andi Albrecht, 13 years ago

Attachment: bug13494.2.diff added

comment:6 by Jannis Leidel, 13 years ago

Resolution: fixed
Status: assignedclosed

(In [14157]) Fixed #13494 -- Correctly concat an email subject prefix with a translation string. Thanks, hcarvalhoalves and Andi Albrecht.

comment:7 by Jannis Leidel, 13 years ago

(In [14159]) [1.2.X] Fixed #13494 -- Correctly concat an email subject prefix with a translation string. Thanks, hcarvalhoalves and Andi Albrecht.

Backport from trunk (r14157).

comment:8 by Jacob, 12 years ago

milestone: 1.3

Milestone 1.3 deleted

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