Fix external email headers from a dict

Review Request #7861 — Created Jan. 12, 2016 and submitted — Latest diff uploaded

Information

Review Board
release-2.0.x
1f260b4...

Reviewers

As described on latest Djblets implementation, there was an issue when an external headers was given to email.message().

a MultiValueDict must be instantiated when headers arg is a dict entries, however this change was not took into account because value was assigned to self._headers attributes instead of updating locale headers variable

https://github.com/djblets/djblets/commit/b41ee0656d40b351df09f3dd2c623c08bb1d3281#diff-bb19b5fe0d299a2fd62aa2c638c6f771R70

This issue is also present in release-2.5.x

original call stack

    message.send()
  File "/usr/local/lib/python2.7/dist-packages/Django-1.6.11.1-py2.7.egg/django/core/mail/message.py", line 276, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/usr/local/lib/python2.7/dist-packages/Django-1.6.11.1-py2.7.egg/django/core/mail/backends/smtp.py", line 94, in send_messages
    sent = self._send(message)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.6.11.1-py2.7.egg/django/core/mail/backends/smtp.py", line 108, in _send
    message = email_message.message()
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-2.0.19-py2.7.egg/reviewboard/notifications/email.py", line 304, in message
    for name, value_list in self.rb_headers.iterlists():
AttributeError: 'dict' object has no attribute 'iterlists'

apply same fix on our test server, the extension responsible to send custom email does not raise anymore AttributeError issue