From fdrake at gmail.com Tue Mar 14 12:48:22 2006 From: fdrake at gmail.com (Fred L. Drake, Jr.) Date: Sun Aug 10 17:05:20 2008 Subject: [ZPT-CVS] CVS: Packages/TAL - TALInterpreter.py:1.78.4.7.24.1 Message-ID: <20060314174822.80F9D203846@mail.zope.org> Update of /cvs-repository/Packages/TAL In directory cvs.zope.org:/tmp/cvs-serv1857/lib/python/TAL Modified Files: Tag: zc-Zope-2-7-5 TALInterpreter.py Log Message: add tests for on-error handling in macros for errors in slot fillers; errors in the filler can now be handled by the macro, as intended === Packages/TAL/TALInterpreter.py 1.78.4.7 => 1.78.4.7.24.1 === --- Packages/TAL/TALInterpreter.py:1.78.4.7 Thu Aug 12 12:15:14 2004 +++ Packages/TAL/TALInterpreter.py Tue Mar 14 12:48:21 2006 @@ -691,11 +691,13 @@ slot = slots.get(slotName) if slot is not None: prev_source = self.sourceFile - self.interpret(slot) - if self.sourceFile != prev_source: - self.engine.setSourceFile(prev_source) - self.sourceFile = prev_source - self.pushMacro(macroName, slots, entering=0) + try: + self.interpret(slot) + finally: + if self.sourceFile != prev_source: + self.engine.setSourceFile(prev_source) + self.sourceFile = prev_source + self.pushMacro(macroName, slots, entering=0) return self.pushMacro(macroName, slots) # Falling out of the 'if' allows the macro to be interpreted. From fdrake at gmail.com Tue Mar 14 12:48:52 2006 From: fdrake at gmail.com (Fred L. Drake, Jr.) Date: Sun Aug 10 17:05:20 2008 Subject: [ZPT-CVS] CVS: Products/PageTemplates/tests - testDTMLTests.py:1.8.108.1 Message-ID: <20060314174852.081A0203846@mail.zope.org> Update of /cvs-repository/Products/PageTemplates/tests In directory cvs.zope.org:/tmp/cvs-serv1857/lib/python/Products/PageTemplates/tests Modified Files: Tag: zc-Zope-2-7-5 testDTMLTests.py Log Message: add tests for on-error handling in macros for errors in slot fillers; errors in the filler can now be handled by the macro, as intended === Products/PageTemplates/tests/testDTMLTests.py 1.8 => 1.8.108.1 === --- Products/PageTemplates/tests/testDTMLTests.py:1.8 Wed Sep 18 11:12:46 2002 +++ Products/PageTemplates/tests/testDTMLTests.py Tue Mar 14 12:48:20 2006 @@ -135,9 +135,49 @@ expect = util.read_output('DTML3.html') util.check_xml(expect, o) + def check_on_error_in_slot_filler(self): + # The `here` isn't defined, so the macro definition is + # expected to catch the error that gets raised. + text = '''\ +
+
+
+ cool +
+
+ +
+
+

+

+
+ ''' + self.t.write(text) + aa = util.argv(('one', 'two', 'three', 'four', 'five')) + self.t.__of__(aa)() + + def check_on_error_in_slot_default(self): + # The `here` isn't defined, so the macro definition is + # expected to catch the error that gets raised. + text = '''\ +
+
+
+
+
+
+
+ +
+
+ ''' + self.t.write(text) + aa = util.argv(('one', 'two', 'three', 'four', 'five')) + self.t.__of__(aa)() + + def test_suite(): return unittest.makeSuite(DTMLTests, 'check') if __name__=='__main__': main() -