Commit 390cc5b0 authored by Jérome Perrin's avatar Jérome Perrin Committed by Arnaud Fontaine

BusinessTemplate: fix export separately on py3

parent e8884d4d
......@@ -832,15 +832,18 @@ class ObjectTemplateItem(BaseTemplateItem):
obj = obj._getCopy(context)
data = getattr(aq_base(obj), record_id, None)
if unicode_data:
if not (six.PY2 and isinstance(data, six.text_type)):
if not isinstance(data, six.text_type):
break
try:
data = data.encode(aq_base(obj).output_encoding)
except (AttributeError, UnicodeEncodeError):
break
elif type(data) is not bytes:
if not isinstance(data, Pdata):
if isinstance(data, str):
data = data.encode()
elif not isinstance(data, Pdata):
break
else:
data = bytes(data)
try:
# Delete this attribute from the object.
......
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