[Zope3-checkins] SVN: Zope3/trunk/src/zope/tal/t Fixed a metal bug
revealed by the Rotterdam skin.
Shane Hathaway
shane at zope.com
Wed Nov 24 01:14:41 EST 2004
Log message for revision 28494:
Fixed a metal bug revealed by the Rotterdam skin.
You should be able to fill a slot defined in a nested define-macro.
It's unclear how the old code behaved in such a situation, but I fixed
the bug by removing a strange case in the code. The code was trying to
prevent slot fillers from being inherited under some special
case, but the case is apparently undocumented and untested, since all
the tests still pass once I removed the strange code. I added a test
for the bug revealed by Rotterdam.
Changed:
U Zope3/trunk/src/zope/tal/talinterpreter.py
A Zope3/trunk/src/zope/tal/tests/input/test_metal8.html
A Zope3/trunk/src/zope/tal/tests/output/test_metal8.html
-=-
Modified: Zope3/trunk/src/zope/tal/talinterpreter.py
===================================================================
--- Zope3/trunk/src/zope/tal/talinterpreter.py 2004-11-23 20:40:21 UTC (rev 28493)
+++ Zope3/trunk/src/zope/tal/talinterpreter.py 2004-11-24 06:14:30 UTC (rev 28494)
@@ -405,8 +405,6 @@
# use-macro and its extensions
if len(macs) > 1:
for macro in macs[1:]:
- if macro is None:
- return ()
extending = macro[3]
if not extending:
return ()
@@ -773,14 +771,6 @@
macs = self.macroStack
wasInUse = self.inUseDirective
self.inUseDirective = False
- if len(macs) == 1:
- entering = macs[-1][4]
- if not entering:
- macs.append(None)
- self.interpret(macro)
- assert macs[-1] is None
- macs.pop()
- return
self.interpret(macro)
self.inUseDirective = wasInUse
bytecode_handlers["defineMacro"] = do_defineMacro
@@ -846,7 +836,7 @@
self.interpret(block)
return
macs = self.macroStack
- if macs and macs[-1] is not None:
+ if macs:
len_macs = len(macs)
# Measure the extension depth of this use-macro
depth = 1
Added: Zope3/trunk/src/zope/tal/tests/input/test_metal8.html
===================================================================
--- Zope3/trunk/src/zope/tal/tests/input/test_metal8.html 2004-11-23 20:40:21 UTC (rev 28493)
+++ Zope3/trunk/src/zope/tal/tests/input/test_metal8.html 2004-11-24 06:14:30 UTC (rev 28494)
@@ -0,0 +1,15 @@
+<html metal:define-macro="page" i18n:domain="zope">
+<body>
+<div metal:define-macro="workspace">
+<div metal:define-slot="body">
+Default body
+</div>
+</div>
+</body>
+</html>
+
+<html metal:use-macro="page">
+<div metal:fill-slot="body">
+Filled-in body
+</div>
+</html>
Added: Zope3/trunk/src/zope/tal/tests/output/test_metal8.html
===================================================================
--- Zope3/trunk/src/zope/tal/tests/output/test_metal8.html 2004-11-23 20:40:21 UTC (rev 28493)
+++ Zope3/trunk/src/zope/tal/tests/output/test_metal8.html 2004-11-24 06:14:30 UTC (rev 28494)
@@ -0,0 +1,19 @@
+<html metal:define-macro="page" i18n:domain="zope">
+<body>
+<div metal:define-macro="workspace">
+<div metal:define-slot="body">
+Default body
+</div>
+</div>
+</body>
+</html>
+
+<html metal:use-macro="page" i18n:domain="zope">
+<body>
+<div>
+<div metal:fill-slot="body">
+Filled-in body
+</div>
+</div>
+</body>
+</html>
More information about the Zope3-Checkins
mailing list