Commit febd0887 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 9e33dc1c 1f7195aa
......@@ -417,7 +417,7 @@ class PythonScript(Script, Historical, Cacheable):
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
......
......@@ -197,6 +197,9 @@ class TestPythonScriptNoAq(PythonScriptTestBase):
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)
......
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