From d8e504cb1d486b9cd1caea7437ff212f92ed4fdb Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 3 Dec 2011 21:25:43 -0500 Subject: make add_route generate the right request methods introspection value --- docs/narr/introspector.rst | 6 ++++-- pyramid/config/routes.py | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 71b41773c..1285a4cf1 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -258,7 +258,8 @@ introspectables in categories not described here. ``request_methods`` A sequence of request method names implied by the ``request_method`` - argument passed to ``add_route``. + argument passed to ``add_route`` or the value ``None`` if a + ``request_method`` argument was not supplied. ``path_info`` @@ -361,7 +362,8 @@ introspectables in categories not described here. ``request_methods`` A sequence of request method names implied by the ``request_method`` - argument passed to ``add_view``. + argument passed to ``add_view`` or the value ``None`` if a + ``request_method`` argument was not supplied. ``route_name`` diff --git a/pyramid/config/routes.py b/pyramid/config/routes.py index 2628f9cac..ea39b6805 100644 --- a/pyramid/config/routes.py +++ b/pyramid/config/routes.py @@ -348,6 +348,9 @@ class RoutesConfiguratorMixin(object): """ # these are route predicates; if they do not match, the next route # in the routelist will be tried + if request_method is not None: + request_method = as_sorted_tuple(request_method) + ignored, predicates, ignored = make_predicates( xhr=xhr, request_method=request_method, @@ -380,7 +383,7 @@ class RoutesConfiguratorMixin(object): intr['pattern'] = pattern intr['factory'] = factory intr['xhr'] = xhr - intr['request_methods'] = as_sorted_tuple(request_method) + intr['request_methods'] = request_method intr['path_info'] = path_info intr['request_param'] = request_param intr['header'] = header -- cgit v1.2.3