diff --git a/flask_mail.py b/flask_mail.py index d0756e5..3ffeb15 100644 --- a/flask_mail.py +++ b/flask_mail.py @@ -62,8 +62,6 @@ def force_text(s, encoding='utf-8', errors='strict'): """ Similar to smart_text, except that lazy instances are resolved to strings, rather than kept as lazy objects. - - If strings_only is True, don't convert (some) non-string-like objects. """ if isinstance(s, text_type): return s @@ -85,10 +83,10 @@ def force_text(s, encoding='utf-8', errors='strict'): if not isinstance(s, Exception): raise FlaskMailUnicodeDecodeError(s, *e.args) else: - s = ' '.join([force_text(arg, encoding, strings_only, - errors) for arg in s]) + s = ' '.join([force_text(arg, encoding, errors) for arg in s]) return s + def sanitize_subject(subject, encoding='utf-8'): try: subject.encode('ascii') @@ -99,6 +97,7 @@ def sanitize_subject(subject, encoding='utf-8'): subject = Header(subject, 'utf-8').encode() return subject + def sanitize_address(addr, encoding='utf-8'): if isinstance(addr, string_types): addr = parseaddr(force_text(addr)) @@ -131,6 +130,7 @@ def _has_newline(line): return True return False + class Connection(object): """Handles connection to host.""" @@ -175,8 +175,8 @@ def send(self, message, envelope_from=None): assert message.send_to, "No recipients have been added" assert message.sender, ( - "The message does not specify a sender and a default sender " - "has not been configured") + "The message does not specify a sender and a default sender " + "has not been configured") if message.has_bad_headers(): raise BadHeaderError