Fix UnicodeDecodeErrors when sending e-mails with utf-8 contents.

Review Request #7553 — Created July 28, 2015 and submitted

Information

Review Board
release-2.0.x
4ee41aa...

Reviewers

When a review request e-mail had utf-8 in the body, it would fail to send
because of a UnicodeDecodeError while assembling the data that gets sent to the
server. The fix is a pretty trivial addition of some .encode() calls.

We hadn't caught this before because the test backend for e-mail in django
doesn't run through the same sort of internal processing as other backends do.
I've changed an existing test case and added a new one so that we use the
console e-mail backend while running the unicode tests, so that we exercise the
same machinery.

Ran unit tests. Before the encode changes, they failed. After, they succeed.

Description From Last Updated

Col: 80 E501 line too long (80 > 79 characters)

reviewbotreviewbot

Col: 80 E501 line too long (81 > 79 characters)

reviewbotreviewbot

Would this maybe be a useful thing to turn into a context manager that other future tests could use?

brenniebrennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/notifications/email.py
        reviewboard/notifications/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/notifications/email.py
        reviewboard/notifications/tests.py
    
    
  2. reviewboard/notifications/tests.py (Diff revision 1)
     
     
    Show all issues
    Col: 80
     E501 line too long (80 > 79 characters)
    
  3. reviewboard/notifications/tests.py (Diff revision 1)
     
     
    Show all issues
    Col: 80
     E501 line too long (81 > 79 characters)
    
  4. 
      
david
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/notifications/email.py
        reviewboard/notifications/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/notifications/email.py
        reviewboard/notifications/tests.py
    
    
  2. 
      
brennie
  1. 
      
  2. reviewboard/notifications/tests.py (Diff revision 2)
     
     
     
     
    Show all issues

    Would this maybe be a useful thing to turn into a context manager that other future tests could use?

  3. 
      
david
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/notifications/email.py
        reviewboard/notifications/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/notifications/email.py
        reviewboard/notifications/tests.py
    
    
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (a9819cb)