[CMF-checkins] SVN: CMF/branches/2.0/CMFCore/ - backporting line ending fix for FSPageTemplates, it was forgotten

Jens Vagelpohl jens at dataflake.org
Mon Mar 13 16:04:14 EST 2006


Log message for revision 65964:
  - backporting line ending fix for FSPageTemplates, it was forgotten
    on the 2.0 branch
  

Changed:
  U   CMF/branches/2.0/CMFCore/FSPageTemplate.py
  A   CMF/branches/2.0/CMFCore/tests/fake_skins/fake_skin/testPT_multiline_python_dos.pt
  A   CMF/branches/2.0/CMFCore/tests/fake_skins/fake_skin/testPT_multiline_python_mac.pt
  A   CMF/branches/2.0/CMFCore/tests/fake_skins/fake_skin/testPT_multiline_python_unix.pt
  U   CMF/branches/2.0/CMFCore/tests/test_FSPageTemplate.py

-=-
Modified: CMF/branches/2.0/CMFCore/FSPageTemplate.py
===================================================================
--- CMF/branches/2.0/CMFCore/FSPageTemplate.py	2006-03-13 19:42:08 UTC (rev 65963)
+++ CMF/branches/2.0/CMFCore/FSPageTemplate.py	2006-03-13 21:04:13 UTC (rev 65964)
@@ -79,7 +79,7 @@
 
     def _readFile(self, reparse):
         fp = expandpath(self._filepath)
-        file = open(fp, 'r')    # not 'rb', as this is a text file!
+        file = open(fp, 'rU')    # not 'rb', as this is a text file!
         try:
             data = file.read()
         finally:

Copied: CMF/branches/2.0/CMFCore/tests/fake_skins/fake_skin/testPT_multiline_python_dos.pt (from rev 65898, CMF/trunk/CMFCore/tests/fake_skins/fake_skin/testPT_multiline_python_dos.pt)

Copied: CMF/branches/2.0/CMFCore/tests/fake_skins/fake_skin/testPT_multiline_python_mac.pt (from rev 65898, CMF/trunk/CMFCore/tests/fake_skins/fake_skin/testPT_multiline_python_mac.pt)

Copied: CMF/branches/2.0/CMFCore/tests/fake_skins/fake_skin/testPT_multiline_python_unix.pt (from rev 65898, CMF/trunk/CMFCore/tests/fake_skins/fake_skin/testPT_multiline_python_unix.pt)

Modified: CMF/branches/2.0/CMFCore/tests/test_FSPageTemplate.py
===================================================================
--- CMF/branches/2.0/CMFCore/tests/test_FSPageTemplate.py	2006-03-13 19:42:08 UTC (rev 65963)
+++ CMF/branches/2.0/CMFCore/tests/test_FSPageTemplate.py	2006-03-13 21:04:13 UTC (rev 65964)
@@ -118,6 +118,14 @@
         self.assertEqual( script.pt_source_file(), 'file:%s'
                                % path_join(self.skin_path_name, 'testPT.pt') )
 
+    def test_foreign_line_endings( self ):
+        # Lead the various line ending files and get their output
+        for fformat in ('unix', 'dos', 'mac'):
+            script = self._makeOne(fformat,
+                                   'testPT_multiline_python_%s.pt' % fformat)
+            script = script.__of__(self.root)
+            self.assertEqual(script(), 'foo bar spam eggs\n')
+
 class FSPageTemplateCustomizationTests( SecurityTest, FSPTMaker ):
 
     def setUp( self ):



More information about the CMF-checkins mailing list