diff options
Diffstat (limited to 'pecan/routing.py')
-rw-r--r-- | pecan/routing.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pecan/routing.py b/pecan/routing.py index 8633220..29a294c 100644 --- a/pecan/routing.py +++ b/pecan/routing.py @@ -137,7 +137,10 @@ def lookup_controller(obj, remainder, request=None): request) handle_security(obj) return obj, remainder - except (exc.HTTPNotFound, PecanNotFound): + except (exc.HTTPNotFound, exc.HTTPMethodNotAllowed, + PecanNotFound) as e: + if isinstance(e, PecanNotFound): + e = exc.HTTPNotFound() while notfound_handlers: name, obj, remainder = notfound_handlers.pop() if name == '_default': @@ -155,11 +158,11 @@ def lookup_controller(obj, remainder, request=None): remainder == [''] and len(obj._pecan['argspec'].args) > 1 ): - raise exc.HTTPNotFound + raise e obj_, remainder_ = result return lookup_controller(obj_, remainder_, request) else: - raise exc.HTTPNotFound + raise e def handle_lookup_traversal(obj, args): |