[Zope-Checkins] SVN: Zope/branches/2.12/ fix regression in traversing to 'macros' on template-based browser views, which crept in somewhere on the way to 2.12

David Glick davidglick at onenw.org
Tue Mar 23 17:43:11 EDT 2010


Log message for revision 110119:
  fix regression in traversing to 'macros' on template-based browser views, which crept in somewhere on the way to 2.12

Changed:
  U   Zope/branches/2.12/doc/CHANGES.rst
  U   Zope/branches/2.12/src/Products/Five/browser/metaconfigure.py
  U   Zope/branches/2.12/src/Products/Five/browser/tests/test_metaconfigure.py

-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===================================================================
--- Zope/branches/2.12/doc/CHANGES.rst	2010-03-23 21:12:19 UTC (rev 110118)
+++ Zope/branches/2.12/doc/CHANGES.rst	2010-03-23 21:43:11 UTC (rev 110119)
@@ -20,6 +20,8 @@
 Bugs Fixed
 ++++++++++
 
+- Restore ability to traverse to 'macros' on template-based browser views.
+
 - Protect ZCTextIndex's clear method against storing Acquisition wrappers.
 
 - LP #195761: fixed ZMI XML export / import and restored it to the UI.

Modified: Zope/branches/2.12/src/Products/Five/browser/metaconfigure.py
===================================================================
--- Zope/branches/2.12/src/Products/Five/browser/metaconfigure.py	2010-03-23 21:12:19 UTC (rev 110118)
+++ Zope/branches/2.12/src/Products/Five/browser/metaconfigure.py	2010-03-23 21:43:11 UTC (rev 110119)
@@ -421,6 +421,8 @@
         raise NotFound(self, name, request)
 
     def __getitem__(self, name):
+        if name == 'macros':
+            return self.index.macros
         return self.index.macros[name]
 
     def __call__(self, *args, **kw):

Modified: Zope/branches/2.12/src/Products/Five/browser/tests/test_metaconfigure.py
===================================================================
--- Zope/branches/2.12/src/Products/Five/browser/tests/test_metaconfigure.py	2010-03-23 21:12:19 UTC (rev 110118)
+++ Zope/branches/2.12/src/Products/Five/browser/tests/test_metaconfigure.py	2010-03-23 21:43:11 UTC (rev 110119)
@@ -41,6 +41,12 @@
         index.macros = {}
         index.macros['aaa'] = aaa = object()
         self.failUnless(view['aaa'] is aaa)
+    
+    def test__getitem__gives_shortcut_to_index_macros(self):
+        view = self._makeOne()
+        view.index = index = DummyTemplate()
+        index.macros = {}
+        self.failUnless(view['macros'] is index.macros)
 
     def test___call___no_args_no_kw(self):
         view = self._makeOne()



More information about the Zope-Checkins mailing list