[Erp5-report] r26405 - in /erp5/trunk/products/ERP5OOo: ./ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Apr 14 04:41:12 CEST 2009
Author: tatuya
Date: Tue Apr 14 04:41:12 2009
New Revision: 26405
URL: http://svn.erp5.org?rev=26405&view=rev
Log:
* Fix:
range-reference and point-reference accepts unicode string
as well as utf-8 string
* Modify:
using restrictedTraverse when ImageField mapping for
better security
Modified:
erp5/trunk/products/ERP5OOo/FormPrintout.py
erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py
Modified: erp5/trunk/products/ERP5OOo/FormPrintout.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/FormPrintout.py?rev=26405&r1=26404&r2=26405&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/FormPrintout.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/FormPrintout.py [utf8] Tue Apr 14 04:41:12 2009
@@ -475,7 +475,7 @@
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 @@
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
Modified: erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py?rev=26405&r1=26404&r2=26405&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py [utf8] Tue Apr 14 04:41:12 2009
@@ -181,6 +181,14 @@
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
More information about the Erp5-report
mailing list