Commit ffa156a3 authored by Stefan H. Holek's avatar Stefan H. Holek

Merged r72753:72754 from 2.9 branch.

Raise SyntaxError when encountering invalid PythonScript headers.
parents 02d2e052 1f7195aa
...@@ -417,7 +417,7 @@ class PythonScript(Script, Historical, Cacheable): ...@@ -417,7 +417,7 @@ class PythonScript(Script, Historical, Cacheable):
k = k.strip().lower() k = k.strip().lower()
v = v.strip() v = v.strip()
if not mdata.has_key(k): if not mdata.has_key(k):
SyntaxError, 'Unrecognized header line "%s"' % line raise SyntaxError, 'Unrecognized header line "%s"' % line
if v == mdata[k]: if v == mdata[k]:
# Unchanged value # Unchanged value
continue continue
......
...@@ -197,6 +197,9 @@ class TestPythonScriptNoAq(PythonScriptTestBase): ...@@ -197,6 +197,9 @@ class TestPythonScriptNoAq(PythonScriptTestBase):
bound = f.__render_with_namespace__({'yes': 1, 'no': self.fail}) bound = f.__render_with_namespace__({'yes': 1, 'no': self.fail})
self.assertEqual(bound, 1) self.assertEqual(bound, 1)
def testNSBindInvalidHeader(self):
self.assertRaises(SyntaxError, self._filePS, 'ns_bind_invalid')
def testBooleanMap(self): def testBooleanMap(self):
res = self._filePS('boolean_map')() res = self._filePS('boolean_map')()
self.failUnless(res) self.failUnless(res)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment