#20371: mail_admins should support strings as arguments
-------------------------------+--------------------------------------
     Reporter:  anonymous      |                    Owner:  nobody
         Type:  Uncategorized  |                   Status:  new
    Component:  Core (Mail)    |                  Version:  1.5
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------
Changes (by anonymous):

 * status:  closed => new
 * resolution:  invalid =>


Comment:

 Sorry, maybe the title of this bug is a bit misleading, it should probably
 be "'''AdminEmailHandler should not raise exception if non-unicode data is
 logged'''".

 The problem here is that mail_admins is called by the logging handler
 (django.utils.log.AdminEmailHandler), and logging handlers should not
 raise exceptions (they should ''log'' them), even if garbage is passed to
 them.

 Replying to [comment:1 russellm]:
 > You're only getting a unicode decode error here because you've put
 unicode content into a byte string.

 No, subject is a valid UTF-8 string:

 {{{
 In [1]: subject="Über"
 In [2]: print subject
 ------> print(subject)
 Über
 In [3]: type(subject)
 Out[3]: <type 'str'>
 In [4]: u_subject=subject.decode("utf-8")
 In [5]: type(u_subject)
 Out[5]: <type 'unicode'>
 In [6]: print u_subject
 ------> print(u_subject)
 Über
 }}}

 BTW, passing ''u_subject'' to mail_admins does work!

 This could be fixed in two places:

 * mail_admins
 * AdminEmailHandler (probably the right place to fix this, sorry for
 initial fuzziness about mail_admins)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20371#comment:2>
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].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to