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

BusinessTemplate: fix export separately on py3

parent fd627836
......@@ -832,16 +832,19 @@ 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
data = bytes(data)
else:
data = bytes(data)
try:
# Delete this attribute from the object.
# in case the related Portal Type does not exist, the object may be broken.
......
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