[Checkins]
SVN: Zope/branches/2.9/lib/python/Products/PythonScripts/
Raise SyntaxError when encountering invalid PythonScript headers.
Stefan H. Holek
stefan at epy.co.at
Thu Feb 22 05:17:22 EST 2007
Log message for revision 72754:
Raise SyntaxError when encountering invalid PythonScript headers.
Changed:
U Zope/branches/2.9/lib/python/Products/PythonScripts/PythonScript.py
U Zope/branches/2.9/lib/python/Products/PythonScripts/tests/testPythonScript.py
A Zope/branches/2.9/lib/python/Products/PythonScripts/tests/tscripts/ns_bind_invalid.ps
-=-
Modified: Zope/branches/2.9/lib/python/Products/PythonScripts/PythonScript.py
===================================================================
--- Zope/branches/2.9/lib/python/Products/PythonScripts/PythonScript.py 2007-02-22 05:58:28 UTC (rev 72753)
+++ Zope/branches/2.9/lib/python/Products/PythonScripts/PythonScript.py 2007-02-22 10:17:20 UTC (rev 72754)
@@ -416,7 +416,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.9/lib/python/Products/PythonScripts/tests/testPythonScript.py
===================================================================
--- Zope/branches/2.9/lib/python/Products/PythonScripts/tests/testPythonScript.py 2007-02-22 05:58:28 UTC (rev 72753)
+++ Zope/branches/2.9/lib/python/Products/PythonScripts/tests/testPythonScript.py 2007-02-22 10:17:20 UTC (rev 72754)
@@ -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)
Added: Zope/branches/2.9/lib/python/Products/PythonScripts/tests/tscripts/ns_bind_invalid.ps
===================================================================
--- Zope/branches/2.9/lib/python/Products/PythonScripts/tests/tscripts/ns_bind_invalid.ps 2007-02-22 05:58:28 UTC (rev 72753)
+++ Zope/branches/2.9/lib/python/Products/PythonScripts/tests/tscripts/ns_bind_invalid.ps 2007-02-22 10:17:20 UTC (rev 72754)
@@ -0,0 +1,3 @@
+##parameters=yes
+##unknownheader='foo'
+return
More information about the Checkins
mailing list