[Checkins] SVN: grokcore.layout/trunk/src/grokcore/layout/components.py factor out looking up the correct layout into a helper method. this helper can now be used in the layout aware form base class in the grok package

Jan Wijbrand Kolman cvs-admin at zope.org
Thu May 10 10:24:45 UTC 2012


Log message for revision 125811:
  factor out looking up the correct layout into a helper method. this helper can now be used in the layout aware form base class in the grok package

Changed:
  U   grokcore.layout/trunk/src/grokcore/layout/components.py

-=-
Modified: grokcore.layout/trunk/src/grokcore/layout/components.py
===================================================================
--- grokcore.layout/trunk/src/grokcore/layout/components.py	2012-05-10 10:15:22 UTC (rev 125810)
+++ grokcore.layout/trunk/src/grokcore/layout/components.py	2012-05-10 10:24:42 UTC (rev 125811)
@@ -76,10 +76,13 @@
 
     layout = None
 
-    def __call__(self):
+    def _get_layout(self):
         wanted = layout.bind().get(self)
-        self.layout = zope.component.getMultiAdapter(
+        return zope.component.getMultiAdapter(
             (self.request, self.context), wanted)
+
+    def __call__(self):
+        self.layout = self._get_layout()
         mapply(self.update, (), self.request)
         if self.request.response.getStatus() in (302, 303):
             # A redirect was triggered somewhere in update().  Don't



More information about the checkins mailing list