Permalink
Browse files

give traverse_predicate a __text__ and add a developer note about __t…

…ext__
  • Loading branch information...
1 parent d204b34 commit 440e2e7d94648973a3f9b5aa6136792d02ae1e9e @mcdonc mcdonc committed Jul 29, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 pyramid/config/util.py
@@ -113,6 +113,12 @@ def make_predicates(xhr=None, request_method=None, path_info=None,
# any predicates get an order of MAX_ORDER, meaning that they will
# be tried very last.
+ # NB: each predicate callable constructed by this function (or examined
+ # by this function, in the case of custom predicates) must leave this
+ # function with a ``__text__`` attribute. The subsystem which reports
+ # errors when no predicates match depends upon the existence of this
+ # attribute on each predicate callable.
+
predicates = []
weights = []
h = md5()
@@ -273,6 +279,7 @@ def traverse_predicate(context, request):
tvalue = tgenerate(m) # tvalue will be urlquoted string
m['traverse'] = traversal_path(tvalue) # will be seq of unicode
return True
+ traverse_predicate.__text__ = 'traverse matchdict pseudo-predicate'
# This isn't actually a predicate, it's just a infodict
# modifier that injects ``traverse`` into the matchdict. As a
# result, the ``traverse_predicate`` function above always

0 comments on commit 440e2e7

Please sign in to comment.