Skip to content

Commit

Permalink
factor out looking up the correct layout into a helper method. this h…
Browse files Browse the repository at this point in the history
…elper can now be used in the layout aware form base class in the grok package
  • Loading branch information
janwijbrand committed May 10, 2012
1 parent 73ad325 commit 5b2f689
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/grokcore/layout/components.py
Expand Up @@ -76,10 +76,13 @@ class LayoutAware(object):

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
Expand Down

0 comments on commit 5b2f689

Please sign in to comment.