[Checkins] SVN: five.grok/branches/view-of-view/src/five/grok/components.py enable view on grok view (e.g. foo/@@view/HEAD)

Jean-Francois Roche jfroche at jfroche.be
Mon Jul 25 11:41:05 EDT 2011


Log message for revision 122344:
  enable view on grok view (e.g. foo/@@view/HEAD)

Changed:
  U   five.grok/branches/view-of-view/src/five/grok/components.py

-=-
Modified: five.grok/branches/view-of-view/src/five/grok/components.py
===================================================================
--- five.grok/branches/view-of-view/src/five/grok/components.py	2011-07-25 15:34:55 UTC (rev 122343)
+++ five.grok/branches/view-of-view/src/five/grok/components.py	2011-07-25 15:41:05 UTC (rev 122344)
@@ -21,6 +21,7 @@
 from zope.annotation.interfaces import IAttributeAnnotatable
 from zope.app.pagetemplate.viewpagetemplatefile import ViewMapper
 from zope.location.interfaces import IPossibleSite
+from zope.publisher.interfaces import NotFound
 from zope import interface, component
 
 from five.formlib import formbase
@@ -83,7 +84,14 @@
             # Set parent so that we have an acquisition chain
             self.static.__parent__ = context
 
+    def publishTraverse(self, request, name):
+        view = component.queryMultiAdapter((self, request), name=name,
+                                           default=None)
+        if view is not None:
+            return view
+        raise NotFound(self, name, request)
 
+
 class ViewAwareZopePageTemplate(ZopePageTemplate):
 
     def pt_getEngine(self):



More information about the checkins mailing list