Commit edcf9c56 authored by Tatuya Kamada's avatar Tatuya Kamada

* Fix:

 range-reference and point-reference accepts unicode string
 as well as utf-8 string

* Modify:
 using restrictedTraverse when ImageField mapping for
 better security
  


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26405 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 408ed97c
......@@ -475,7 +475,7 @@ class ODFStrategy(Implicit):
if len(image_list) is 0:
return element_tree
path = image_field.get_value('default')
picture = self.getPortalObject().unrestrictedTraverse(path)
picture = self.getPortalObject().restrictedTraverse(path)
picture_data = getattr(aq_base(picture), 'data', None)
picture_type = picture.getContentType()
picture_path = self._createOdfUniqueFileName(path=path, picture_type=picture_type)
......@@ -741,7 +741,9 @@ class ODFStrategy(Implicit):
def _toUnicodeString(self, field_value = None):
value = ''
if field_value is not None:
if isinstance(field_value, unicode):
value = field_value
elif field_value is not None:
value = unicode(str(field_value), 'utf-8')
return value
......
......@@ -181,6 +181,14 @@ class TestFormPrintout(ERP5TypeTestCase):
builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml")
self.assertTrue(content_xml.find("Français") > 0)
# 6. Normal case: unicode string
test1.setTitle(u'Français test2')
odf_document = foo_printout()
self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml")
self.assertTrue(content_xml.find("Français test2") > 0)
def test_02_Table_01_Normal(self, run=run_all_test):
"""To test listbox and ODF table mapping
......
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