Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider superclass views after predicate mismatch #1004

Merged
merged 2 commits into from Jul 15, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CONTRIBUTORS.txt
Expand Up @@ -198,3 +198,5 @@ Contributors
- Georges Dubus, 2013/03/21

- Jason McKellar, 2013/03/28

- Laurence Rowe, 2013/04/24
2 changes: 1 addition & 1 deletion pyramid/router.py
Expand Up @@ -165,7 +165,7 @@ def handle_request(self, request):
except PredicateMismatch:
# look for other views that meet the predicate
# criteria
for iface in context_iface.flattened():
for iface in context_iface.__sro__[1:]:
view_callable = adapters.lookup(
(IViewClassifier, request.request_iface, iface),
IView, name=view_name, default=None)
Expand Down
8 changes: 3 additions & 5 deletions pyramid/tests/test_router.py
Expand Up @@ -1180,11 +1180,9 @@ def test_call_view_predicate_mismatch_doesnt_hide_views(self):
from pyramid.interfaces import IViewClassifier
from pyramid.interfaces import IRequest, IResponse
from pyramid.response import Response
from zope.interface import Interface, implementer
class IContext(Interface):
class BaseContext:
pass
@implementer(IContext)
class DummyContext:
class DummyContext(BaseContext):
pass
context = DummyContext()
self._registerTraverserFactory(context)
Expand All @@ -1193,7 +1191,7 @@ class DummyContext:
DummyContext)
good_view = DummyView('abc')
self._registerView(self.config.derive_view(good_view),
'', IViewClassifier, IRequest, IContext)
'', IViewClassifier, IRequest, BaseContext)
router = self._makeOne()
def make_response(s):
return Response(s)
Expand Down