Skip to content

Commit

Permalink
Avoid re-executing the same view when looking up context base views.
Browse files Browse the repository at this point in the history
This is a tweak of #1004.

Really we should be using subscribers here instead of adapters, but
zope.interface doesn't yet suppport named subscribers.
  • Loading branch information
lrowe committed Jul 15, 2013
1 parent b6d0070 commit 84b9027
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pyramid/router.py
Expand Up @@ -165,9 +165,13 @@ def handle_request(self, request):
# look for other views that meet the predicate
# criteria
for iface in context_iface.__sro__[1:]:
previous_view_callable = view_callable
view_callable = adapters.lookup(
(IViewClassifier, request.request_iface, iface),
IView, name=view_name, default=None)
# intermediate bases may lookup same view_callable
if view_callable is previous_view_callable:
continue
if view_callable is not None:
try:
response = view_callable(context, request)
Expand Down

0 comments on commit 84b9027

Please sign in to comment.