Commit 8098941a authored by Jérome Perrin's avatar Jérome Perrin

Merge remote-tracking branch 'upstream/master' into zope4py2

parents e16c35c5 0162ede8
...@@ -134,6 +134,17 @@ class TestZODBHistory(ERP5TypeTestCase): ...@@ -134,6 +134,17 @@ class TestZODBHistory(ERP5TypeTestCase):
from zExceptions import Unauthorized from zExceptions import Unauthorized
self.assertRaises(Unauthorized, document.Base_viewZODBHistory) self.assertRaises(Unauthorized, document.Base_viewZODBHistory)
def test_ZODBHistoryNonAsciiProperty(self):
self.loginByUserName('tatuya')
document = self.addOrganisation(self.id())
document.edit(title='ネクセディ', default_address_city='千代田区')
self.commit()
_, change, = document.Base_getZODBHistoryList()
self.assertIn('title:ネクセディ', change.getProperty('changes'))
# no encoding error
document.Base_viewZODBHistory()
def test_ZODBHistoryBinaryData(self): def test_ZODBHistoryBinaryData(self):
""" """
Make sure ZODB History view works with binary content Make sure ZODB History view works with binary content
......
...@@ -13,10 +13,10 @@ def beautifyChange(change_dict): ...@@ -13,10 +13,10 @@ def beautifyChange(change_dict):
for property_name, property_value in sorted(change_dict.items()): for property_name, property_value in sorted(change_dict.items()):
if isinstance(property_value, six.binary_type): if isinstance(property_value, six.binary_type):
try: try:
property_value = six.text_type(property_value, 'utf-8') six.text_type(property_value, 'utf-8')
except UnicodeDecodeError: except UnicodeDecodeError:
property_value = '(binary)' property_value = '(binary)'
change_list.append('%s:%s' % (property_name, property_value)) change_list.append('{}:{}'.format(property_name, property_value))
return change_list return change_list
try: try:
......
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