[Zope3-checkins] SVN: Zope3/trunk/src/zope/ enable
previously-failing test, adding in a fix for the problem:
Fred L. Drake, Jr.
fdrake at gmail.com
Tue Mar 14 12:46:43 EST 2006
Log message for revision 66016:
enable previously-failing test, adding in a fix for the problem:
an on-error expression in a macro can now handle exceptions from slot fillers
as intended
Changed:
U Zope3/trunk/src/zope/pagetemplate/tests/test_basictemplate.py
U Zope3/trunk/src/zope/tal/talinterpreter.py
-=-
Modified: Zope3/trunk/src/zope/pagetemplate/tests/test_basictemplate.py
===================================================================
--- Zope3/trunk/src/zope/pagetemplate/tests/test_basictemplate.py 2006-03-14 16:23:33 UTC (rev 66015)
+++ Zope3/trunk/src/zope/pagetemplate/tests/test_basictemplate.py 2006-03-14 17:46:42 UTC (rev 66016)
@@ -126,8 +126,8 @@
expect = util.read_output('dtml3.html')
util.check_xml(expect, o)
- def _test_on_error_in_slot_filler(self):
- # The here/xxx isn't defined, so the macro definition is
+ def test_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 = '''\
<div metal:define-macro="foo">
@@ -147,7 +147,7 @@
self.t()
def test_on_error_in_slot_default(self):
- # The here/xxx isn't defined, so the macro definition is
+ # The `here` isn't defined, so the macro definition is
# expected to catch the error that gets raised.
text = '''\
<div metal:define-macro="foo">
Modified: Zope3/trunk/src/zope/tal/talinterpreter.py
===================================================================
--- Zope3/trunk/src/zope/tal/talinterpreter.py 2006-03-14 16:23:33 UTC (rev 66015)
+++ Zope3/trunk/src/zope/tal/talinterpreter.py 2006-03-14 17:46:42 UTC (rev 66016)
@@ -962,14 +962,16 @@
chopped = macs[i:]
del macs[i:]
prev_source = self.sourceFile
- self.interpret(slot)
- if self.sourceFile != prev_source:
- self.engine.setSourceFile(prev_source)
- self.sourceFile = prev_source
- # Restore the stack entries.
- for mac in chopped:
- mac.entering = False # Not entering
- macs.extend(chopped)
+ try:
+ self.interpret(slot)
+ finally:
+ if self.sourceFile != prev_source:
+ self.engine.setSourceFile(prev_source)
+ self.sourceFile = prev_source
+ # Restore the stack entries.
+ for mac in chopped:
+ mac.entering = False # Not entering
+ macs.extend(chopped)
return
# Falling out of the 'if' allows the macro to be interpreted.
self.interpret(block)
More information about the Zope3-Checkins
mailing list