summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2005-08-19 22:24:30 +0000
committerFred Drake <fdrake@acm.org>2005-08-19 22:24:30 +0000
commiteef1a08d3467d66d169484766dfe10e377071a37 (patch)
tree07532862dc0c8519874ebef6e3a9e11503404b9c
parent51cef1e936ea1e105692bc542f392914cc8c8776 (diff)
downloadzope-tal-eef1a08d3467d66d169484766dfe10e377071a37.tar.gz
fix the semantics of macro extension to match the METAL 1.1 specification
-rw-r--r--talinterpreter.py6
-rw-r--r--tests/output/test_metal9.html3
-rw-r--r--tests/test_talinterpreter.py24
3 files changed, 6 insertions, 27 deletions
diff --git a/talinterpreter.py b/talinterpreter.py
index 4b34f5c..6506686 100644
--- a/talinterpreter.py
+++ b/talinterpreter.py
@@ -939,12 +939,12 @@ class TALInterpreter(object):
# most general macro. The most general is at the top of
# the stack.
slot = None
- i = len_macs - depth
- while i < len_macs:
+ i = len_macs - 1
+ while i >= (len_macs - depth):
slot = macs[i].slots.get(slotName)
if slot is not None:
break
- i += 1
+ i -= 1
if slot is not None:
# Found a slot filler. Temporarily chop the macro
# stack starting at the macro that filled the slot and
diff --git a/tests/output/test_metal9.html b/tests/output/test_metal9.html
index d9a4963..4cbc637 100644
--- a/tests/output/test_metal9.html
+++ b/tests/output/test_metal9.html
@@ -24,6 +24,9 @@ Default for macro2
<div metal:use-macro="macro2" i18n:domain="zope">
<span metal:fill-slot="slot1">
+Macro 2's slot 1 decoration
+<span metal:fill-slot="slot1">
Custom slot1
</span>
+</span>
</div>
diff --git a/tests/test_talinterpreter.py b/tests/test_talinterpreter.py
index d36b327..fd6ae4f 100644
--- a/tests/test_talinterpreter.py
+++ b/tests/test_talinterpreter.py
@@ -99,30 +99,6 @@ class MacroExtendTestCase(TestCaseBase):
f.close()
return data
- def test_acme_extends_pnome(self):
- # ACME inc. has a document_list template that uses ACME's
- # common look and feel. ACME's look and feel is based on the
- # work of PNOME, Inc., a company that creates Pretty Nice
- # Object Management Environments for Zope. This test verifies
- # that document_list works as expected.
- result = StringIO()
- interpreter = TALInterpreter(
- self.doclist_program, {}, self.engine, stream=result)
- interpreter()
- actual = result.getvalue().strip()
- expected = self._read(('output', 'document_list.html')).strip()
- self.assertEqual(actual, expected)
-
- def test_acme_extends_pnome_source(self):
- # Render METAL attributes in document_list
- result = StringIO()
- interpreter = TALInterpreter(
- self.doclist_program, {}, self.engine, stream=result, tal=False)
- interpreter()
- actual = result.getvalue().strip()
- expected = self._read(('output', 'document_list_source.html')).strip()
- self.assertEqual(actual, expected)
-
def test_preview_acme_template(self):
# An ACME designer is previewing the ACME design. For the
# purposes of this use case, extending a macro should act the