Permalink
Browse files

Merge branch 'master' of git://github.com/adroullier/pyramid into adr…

…oullier-master
  • Loading branch information...
2 parents 440e2e7 + c52e649 commit 8e45c9df2bf35428f47e106f932d996f18b45395 @mcdonc mcdonc committed Jul 29, 2012
Showing with 7 additions and 5 deletions.
  1. +7 −5 pyramid/config/views.py
View
@@ -276,11 +276,13 @@ def predicated_view(self, view):
if not predicates:
return view
def predicate_wrapper(context, request):
- if all((predicate(context, request) for predicate in predicates)):
- return view(context, request)
- view_name = getattr(view, '__name__', view)
- raise PredicateMismatch(
- 'predicate mismatch for view %s' % view_name)
+ for predicate in predicates:
+ if not predicate(context, request):
+ view_name = getattr(view, '__name__', view)
+ raise PredicateMismatch(
+ 'predicate mismatch for view %s (%s)' % (
+ view_name, predicate.__text__))
+ return view(context, request)
def checker(context, request):
return all((predicate(context, request) for predicate in
predicates))

0 comments on commit 8e45c9d

Please sign in to comment.