diff options
-rw-r--r-- | talinterpreter.py | 6 | ||||
-rw-r--r-- | tests/output/test_metal9.html | 3 | ||||
-rw-r--r-- | tests/test_talinterpreter.py | 24 |
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 |