Commit 80b90e7c authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Arnaud Fontaine
Browse files

py2/py3: unicode() does not exist in Python 3.

parent 4e156dc2
......@@ -1389,10 +1389,14 @@ class TestZodbPropertySheet(ERP5TypeTestCase):
with self.assertRaises(TypeError):
person.setSocialTitle(social_title_value)
# Passing a unicode object to a not-Value setter should raise
with self.assertRaises(TypeError):
organisation = self.portal.organisation_module.newContent()
person.setSubordination(unicode(organisation.getRelativeUrl()))
if six.PY2:
# Passing a unicode object to a not-Value setter should raise
person.setSubordination(six.text_type(organisation.getRelativeUrl()))
else:
# Passing a bytes object to a not-Value setter should raise
person.setSubordination(organisation.getRelativeUrl().encode())
from Products.ERP5Type.Tool.ComponentTool import ComponentTool
......
......@@ -535,7 +535,7 @@ class SafeHTML:
# avoid breaking now.
# continue into the loop with repaired html
else:
if isinstance(orig, unicode):
if isinstance(orig, six.text_type):
orig = orig.encode('utf-8')
data.setData(orig)
break
......
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