Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove strings_only from force_text #141

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions flask_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')
Expand All @@ -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))
Expand Down Expand Up @@ -131,6 +130,7 @@ def _has_newline(line):
return True
return False


class Connection(object):
"""Handles connection to host."""

Expand Down Expand Up @@ -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
Expand Down