[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Products/PythonScripts/ Merged r72753:72754 from 2.9 branch.

Stefan H. Holek stefan at epy.co.at
Thu Feb 22 05:19:27 EST 2007


Log message for revision 72755:
  Merged r72753:72754 from 2.9 branch.
  
  Raise SyntaxError when encountering invalid PythonScript headers.
  

Changed:
  U   Zope/branches/2.10/lib/python/Products/PythonScripts/PythonScript.py
  U   Zope/branches/2.10/lib/python/Products/PythonScripts/tests/testPythonScript.py
  A   Zope/branches/2.10/lib/python/Products/PythonScripts/tests/tscripts/ns_bind_invalid.ps

-=-
Modified: Zope/branches/2.10/lib/python/Products/PythonScripts/PythonScript.py
===================================================================
--- Zope/branches/2.10/lib/python/Products/PythonScripts/PythonScript.py	2007-02-22 10:17:20 UTC (rev 72754)
+++ Zope/branches/2.10/lib/python/Products/PythonScripts/PythonScript.py	2007-02-22 10:19:26 UTC (rev 72755)
@@ -417,7 +417,7 @@
                 k = k.strip().lower()
                 v = v.strip()
                 if not mdata.has_key(k):
-                    SyntaxError, 'Unrecognized header line "%s"' % line
+                    raise SyntaxError, 'Unrecognized header line "%s"' % line
                 if v == mdata[k]:
                     # Unchanged value
                     continue

Modified: Zope/branches/2.10/lib/python/Products/PythonScripts/tests/testPythonScript.py
===================================================================
--- Zope/branches/2.10/lib/python/Products/PythonScripts/tests/testPythonScript.py	2007-02-22 10:17:20 UTC (rev 72754)
+++ Zope/branches/2.10/lib/python/Products/PythonScripts/tests/testPythonScript.py	2007-02-22 10:19:26 UTC (rev 72755)
@@ -197,6 +197,9 @@
         bound = f.__render_with_namespace__({'yes': 1, 'no': self.fail})
         self.assertEqual(bound, 1)
 
+    def testNSBindInvalidHeader(self):
+        self.assertRaises(SyntaxError, self._filePS, 'ns_bind_invalid')
+
     def testBooleanMap(self):
         res = self._filePS('boolean_map')()
         self.failUnless(res)

Copied: Zope/branches/2.10/lib/python/Products/PythonScripts/tests/tscripts/ns_bind_invalid.ps (from rev 72754, Zope/branches/2.9/lib/python/Products/PythonScripts/tests/tscripts/ns_bind_invalid.ps)



More information about the Zope-Checkins mailing list