summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurence Rowe <laurence@lrowe.co.uk>2013-07-14 21:33:24 -0700
committerLaurence Rowe <laurence@lrowe.co.uk>2013-07-14 21:33:24 -0700
commit84b9027389615084eaf402f8f2aae2ec7199bd67 (patch)
treee0e7b453eb434d338d09355d52be2c64ffbde8ba
parentb6d007065132ad313a0777eb89a71b6fbdc4bcdf (diff)
downloadpyramid-84b9027389615084eaf402f8f2aae2ec7199bd67.tar.gz
pyramid-84b9027389615084eaf402f8f2aae2ec7199bd67.tar.bz2
pyramid-84b9027389615084eaf402f8f2aae2ec7199bd67.zip
Avoid re-executing the same view when looking up context base views.
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.
-rw-r--r--pyramid/router.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/pyramid/router.py b/pyramid/router.py
index 3d2a2ff3e..1a991648b 100644
--- a/pyramid/router.py
+++ b/pyramid/router.py
@@ -165,9 +165,13 @@ class Router(object):
# 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)