[Checkins] SVN: megrok.layout/branches/jw-adapting-view-too-perhaps/src/megrok/layout/ perhaps adapt the view too as the view really is needed anyway throughout the "live cycle" of a layout component

Jan-Wijbrand Kolman janwijbrand at gmail.com
Mon Jun 27 03:06:49 EDT 2011


Log message for revision 121981:
  perhaps adapt the view too as the view really is needed anyway throughout the "live cycle" of a layout component

Changed:
  U   megrok.layout/branches/jw-adapting-view-too-perhaps/src/megrok/layout/CREDITS.txt
  U   megrok.layout/branches/jw-adapting-view-too-perhaps/src/megrok/layout/components.py
  U   megrok.layout/branches/jw-adapting-view-too-perhaps/src/megrok/layout/tests/layout/staticfolder.py

-=-
Modified: megrok.layout/branches/jw-adapting-view-too-perhaps/src/megrok/layout/CREDITS.txt
===================================================================
--- megrok.layout/branches/jw-adapting-view-too-perhaps/src/megrok/layout/CREDITS.txt	2011-06-26 12:24:43 UTC (rev 121980)
+++ megrok.layout/branches/jw-adapting-view-too-perhaps/src/megrok/layout/CREDITS.txt	2011-06-27 07:06:49 UTC (rev 121981)
@@ -11,7 +11,6 @@
 
   - Souheil Chelfouh <trollfot at gmail.com>
 
-
 Sponsors
 --------
 

Modified: megrok.layout/branches/jw-adapting-view-too-perhaps/src/megrok/layout/components.py
===================================================================
--- megrok.layout/branches/jw-adapting-view-too-perhaps/src/megrok/layout/components.py	2011-06-26 12:24:43 UTC (rev 121980)
+++ megrok.layout/branches/jw-adapting-view-too-perhaps/src/megrok/layout/components.py	2011-06-27 07:06:49 UTC (rev 121981)
@@ -37,10 +37,10 @@
     grok.baseclass()
     grok.implements(ILayout)
 
-    def __init__(self, request, context):
+    def __init__(self, request, context, view):
         self.context = context
         self.request = request
-        self.view = None
+        self.view = view
 
         if getattr(self, 'module_info', None) is not None:
             self.static = zope.component.queryAdapter(
@@ -72,8 +72,7 @@
 
     render.base_method = True
 
-    def __call__(self, view):
-        self.view = view
+    def __call__(self):
         self.update()
         return self.render()
 
@@ -95,8 +94,8 @@
             # continue rendering the template or doing anything else.
             return
         self.layout = zope.component.getMultiAdapter(
-            (self.request, self.context), ILayout)
-        return self.layout(self)
+            (self.request, self.context, self), ILayout)
+        return self.layout()
 
     def default_namespace(self):
         namespace = super(Page, self).default_namespace()
@@ -143,8 +142,8 @@
             return
 
         self.layout = zope.component.getMultiAdapter(
-            (self.request, self.context), ILayout)
-        return self.layout(self)
+            (self.request, self.context, self), ILayout)
+        return self.layout()
 
 
 # Default forms for form without the html and body tags

Modified: megrok.layout/branches/jw-adapting-view-too-perhaps/src/megrok/layout/tests/layout/staticfolder.py
===================================================================
--- megrok.layout/branches/jw-adapting-view-too-perhaps/src/megrok/layout/tests/layout/staticfolder.py	2011-06-26 12:24:43 UTC (rev 121980)
+++ megrok.layout/branches/jw-adapting-view-too-perhaps/src/megrok/layout/tests/layout/staticfolder.py	2011-06-27 07:06:49 UTC (rev 121981)
@@ -3,7 +3,7 @@
   >>> from zope.component import getMultiAdapter
   >>> from zope.publisher.browser import TestRequest
   >>> request = TestRequest()
-  >>> from megrok.layout.tests.layout.static_fixture.simple import Dummy 
+  >>> from megrok.layout.tests.layout.static_fixture.simple import Dummy
   >>> mongo = Dummy()
   >>> mylayout = getMultiAdapter((request, mongo), ILayout)
   >>> mylayout.static
@@ -19,7 +19,8 @@
 from zope.publisher.interfaces.browser import IBrowserRequest
 
 
-zope.component.provideAdapter(factory=DummyResource,
+zope.component.provideAdapter(
+    factory=DummyResource,
     adapts=(IBrowserRequest,),
     provides=zope.interface.Interface,
     name='megrok.layout.tests.layout.static_fixture')



More information about the checkins mailing list