#20476: add a message_factory policy attribute to email.

This commit is contained in:
R David Murray 2016-09-09 18:39:18 -04:00
parent 37df068e86
commit 06ed218ed0
9 changed files with 128 additions and 66 deletions

View file

@ -154,6 +154,8 @@ class Policy(_PolicyBase, metaclass=abc.ABCMeta):
them. This is used when the message is being
serialized by a generator. Default: True.
message_factory -- the class to use to create new message objects.
"""
raise_on_defect = False
@ -161,6 +163,8 @@ class Policy(_PolicyBase, metaclass=abc.ABCMeta):
cte_type = '8bit'
max_line_length = 78
mangle_from_ = False
# XXX To avoid circular imports, this is set in email.message.
message_factory = None
def handle_defect(self, obj, defect):
"""Based on policy, either raise defect or call register_defect.