Ticket #13494: bug13494.diff

File bug13494.diff, 2.4 KB (added by Andi Albrecht, 14 years ago)
  • django/core/mail/__init__.py

    diff --git a/django/core/mail/__init__.py b/django/core/mail/__init__.py
    index f9d1210..8a2d9bf 100644
    a b def mail_admins(subject, message, fail_silently=False, connection=None):  
    8787    """Sends a message to the admins, as defined by the ADMINS setting."""
    8888    if not settings.ADMINS:
    8989        return
    90     EmailMessage(settings.EMAIL_SUBJECT_PREFIX + subject, message,
     90    EmailMessage(u'%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject), message,
    9191                 settings.SERVER_EMAIL, [a[1] for a in settings.ADMINS],
    9292                 connection=connection).send(fail_silently=fail_silently)
    9393
    def mail_managers(subject, message, fail_silently=False, connection=None):  
    9696    """Sends a message to the managers, as defined by the MANAGERS setting."""
    9797    if not settings.MANAGERS:
    9898        return
    99     EmailMessage(settings.EMAIL_SUBJECT_PREFIX + subject, message,
     99    EmailMessage(u'%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject), message,
    100100                 settings.SERVER_EMAIL, [a[1] for a in settings.MANAGERS],
    101101                 connection=connection).send(fail_silently=fail_silently)
    102102
  • tests/regressiontests/mail/tests.py

    diff --git a/tests/regressiontests/mail/tests.py b/tests/regressiontests/mail/tests.py
    index 84be585..6b93304 100644
    a b Message-ID: ...  
    414414Content
    415415-------------------------------------------------------------------------------
    416416
     417# Make sure that adding a prefix works with translated subject (#13494).
     418>>> mail_managers(ugettext_lazy('Subject'), 'Content', connection=connection)
     419Content-Type: text/plain; charset="utf-8"
     420MIME-Version: 1.0
     421Content-Transfer-Encoding: quoted-printable
     422Subject: [Django] Subject
     423From: root@localhost
     424To: nobody@example.com
     425Date: ...
     426Message-ID: ...
     427
     428Content
     429-------------------------------------------------------------------------------
     430
     431>>> mail_admins(ugettext_lazy('Subject'), 'Content', connection=connection)
     432Content-Type: text/plain; charset="utf-8"
     433MIME-Version: 1.0
     434Content-Transfer-Encoding: quoted-printable
     435Subject: [Django] Subject
     436From: root@localhost
     437To: nobody@example.com
     438Date: ...
     439Message-ID: ...
     440
     441Content
     442-------------------------------------------------------------------------------
     443
     444
    417445>>> settings.ADMINS = old_admins
    418446>>> settings.MANAGERS = old_managers
    419447
Back to Top