Commit edb6d5d0 authored by Nicolas Delaby's avatar Nicolas Delaby

default value should be return if mail content is empty

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23240 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a8469ee8
......@@ -295,11 +295,15 @@ class EmailDocument(File, TextDocument):
part_encoding = part.get_content_charset()
if part_encoding not in (None, 'utf-8',):
try:
return part.get_payload(decode=1).decode(part_encoding).encode('utf-8')
text_result = part.get_payload(decode=1).\
decode(part_encoding).encode('utf-8')
except (UnicodeDecodeError, LookupError):
return part.get_payload(decode=1)
return part.get_payload(decode=1)
return text_result
text_result = part.get_payload(decode=1)
else:
text_result = part.get_payload(decode=1)
if default is _MARKER:
return text_result
return text_result or default
security.declareProtected(Permissions.AccessContentsInformation, 'getTextFormat')
def getTextFormat(self, default=_MARKER):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment