send_email: Fix modification of mutable default value.

This commit is contained in:
Tim Abbott
2017-08-25 09:43:53 -07:00
parent 537ad1ff1b
commit bee86b6e6b

View File

@@ -17,8 +17,8 @@ class FromAddress(object):
# Intended only for test code
def build_email(template_prefix, to_user_id=None, to_email=None, from_name=None,
from_address=None, reply_to_email=None, context={}):
# type: (str, Optional[int], Optional[Text], Optional[Text], Optional[Text], Optional[Text], Dict[str, Any]) -> EmailMultiAlternatives
from_address=None, reply_to_email=None, context=None):
# type: (str, Optional[int], Optional[Text], Optional[Text], Optional[Text], Optional[Text], Optional[Dict[str, Any]]) -> EmailMultiAlternatives
# Callers should pass exactly one of to_user_id and to_email.
assert (to_user_id is None) ^ (to_email is None)
if to_user_id is not None:
@@ -27,6 +27,9 @@ def build_email(template_prefix, to_user_id=None, to_email=None, from_name=None,
# https://github.com/zulip/zulip/issues/4676 is resolved
to_email = to_user.email
if context is None:
context = {}
context.update({
'realm_name_in_notifications': False,
'support_email': FromAddress.SUPPORT,