Skip to content

Commit

Permalink
Merge pull request #1046 from lrowe/skip-same-views
Browse files Browse the repository at this point in the history
Avoid re-executing the same view when looking up context base views.
  • Loading branch information
mmerickel committed Jul 16, 2013
2 parents b6d0070 + 84b9027 commit ab457f8
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 ab457f8

Please sign in to comment.