Commit 120cc688 authored by Carlos Ramos Carreño's avatar Carlos Ramos Carreño Committed by Jérome Perrin

Fix tests for erp5_officejs in Python 2.

parent 6a681445
......@@ -8,6 +8,8 @@ Redirect to domain specified as layout property on website
import binascii
import base64
from Products.ERP5Type.Utils import bytes2str, str2bytes
import six
result_dict = {"error":"url missing definition view path"}
base_64 = False
......@@ -19,8 +21,9 @@ except KeyError:
return result_dict
try:
encoded = name.replace("definition_view/", "", 1).encode()
name = base64.decodebytes(encoded).decode()
encoded = str2bytes(name.replace("definition_view/", "", 1))
decode_method = base64.decodebytes if six.PY3 else base64.decodestring
name = bytes2str(decode_method(encoded))
base_64 = True
except binascii.Error:
pass
......
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