summaryrefslogtreecommitdiff
path: root/pecan/routing.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-05-21 23:15:28 +0000
committerGerrit Code Review <review@openstack.org>2015-05-21 23:15:28 +0000
commitf09076cf1089d32926140c02a8ab26d40bb4c983 (patch)
treeebcad5a758e35fa57e482609d71a75427bc06740 /pecan/routing.py
parent5e48da32acbc3fb6575981d7731d55e5931e9960 (diff)
parent3c634de56666cfadf19b813dd9de4e7e66b6ac65 (diff)
downloadpecan-f09076cf1089d32926140c02a8ab26d40bb4c983.tar.gz
Merge "Properly raise HTTP 405 (and specify Allow headers) for RestController"
Diffstat (limited to 'pecan/routing.py')
-rw-r--r--pecan/routing.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/pecan/routing.py b/pecan/routing.py
index 1d534aa..91c9fe3 100644
--- a/pecan/routing.py
+++ b/pecan/routing.py
@@ -49,7 +49,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':
@@ -67,11 +70,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):