[Checkins] SVN: Products.GenericSetup/trunk/ - fixed export encoding (since GS 1.7.0 exports have to be utf-8 strings)

Yvo Schubbe cvs-admin at zope.org
Mon Jun 18 08:32:26 UTC 2012


Log message for revision 126908:
  - fixed export encoding (since GS 1.7.0 exports have to be utf-8 strings)

Changed:
  U   Products.GenericSetup/trunk/Products/GenericSetup/PageTemplates/exportimport.py
  U   Products.GenericSetup/trunk/Products/GenericSetup/testing.py
  U   Products.GenericSetup/trunk/docs/CHANGES.rst

-=-
Modified: Products.GenericSetup/trunk/Products/GenericSetup/PageTemplates/exportimport.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/PageTemplates/exportimport.py	2012-06-17 21:37:08 UTC (rev 126907)
+++ Products.GenericSetup/trunk/Products/GenericSetup/PageTemplates/exportimport.py	2012-06-18 08:32:22 UTC (rev 126908)
@@ -31,7 +31,10 @@
     def _exportBody(self):
         """Export the object as a file body.
         """
-        return self.context.read()
+        text = self.context.read()
+        if isinstance(text, unicode):
+            return text.encode('utf-8')
+        return text
 
     def _importBody(self, body):
         """Import the object from the file body.

Modified: Products.GenericSetup/trunk/Products/GenericSetup/testing.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/testing.py	2012-06-17 21:37:08 UTC (rev 126907)
+++ Products.GenericSetup/trunk/Products/GenericSetup/testing.py	2012-06-18 08:32:22 UTC (rev 126908)
@@ -83,6 +83,7 @@
         context = DummySetupEnviron()
         adapted = getMultiAdapter((self._obj, context), IBody)
         self.assertEqual(adapted.body, self._BODY)
+        self.assertTrue(isinstance(adapted.body, str))
 
     def test_body_set(self):
         context = DummySetupEnviron()

Modified: Products.GenericSetup/trunk/docs/CHANGES.rst
===================================================================
--- Products.GenericSetup/trunk/docs/CHANGES.rst	2012-06-17 21:37:08 UTC (rev 126907)
+++ Products.GenericSetup/trunk/docs/CHANGES.rst	2012-06-18 08:32:22 UTC (rev 126908)
@@ -4,7 +4,7 @@
 1.7.2 (unreleased)
 ------------------
 
-- TBD
+- ZopePageTemplate handler: Fixed export encoding.
 
 
 1.7.1 (2012-02-28)



More information about the checkins mailing list