Commit f876f537 authored by Jérome Perrin's avatar Jérome Perrin

BusinessTemplate: fix export separately on py3

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