Move calls to self.app outside of error handling
On py3, if/when you hit an error, you can get very noisy tracebacks like <traceback coming out of split_path()> During handling of the above exception, another exception occurred: <meaningful traceback> In general, I like this, but when we've used exception handling for flow-control, it gets difficult to separate the wheat from the chaff. Change-Id: I5f3bc6416207cab2c7e3a77ee6689360b55990e7
This commit is contained in:
parent
74e1f2e053
commit
5573354655
@ -225,7 +225,10 @@ class ServerSideCopyMiddleware(object):
|
||||
req = Request(env)
|
||||
try:
|
||||
(version, account, container, obj) = req.split_path(4, 4, True)
|
||||
is_obj_req = True
|
||||
except ValueError:
|
||||
is_obj_req = False
|
||||
if not is_obj_req:
|
||||
# If obj component is not present in req, do not proceed further.
|
||||
return self.app(env, start_response)
|
||||
|
||||
|
@ -433,7 +433,10 @@ class Decrypter(object):
|
||||
req = Request(env)
|
||||
try:
|
||||
parts = req.split_path(3, 4, True)
|
||||
is_cont_or_obj_req = True
|
||||
except ValueError:
|
||||
is_cont_or_obj_req = False
|
||||
if not is_cont_or_obj_req:
|
||||
return self.app(env, start_response)
|
||||
|
||||
if parts[3] and req.method in ('GET', 'HEAD'):
|
||||
|
@ -420,7 +420,10 @@ class DynamicLargeObject(object):
|
||||
req = Request(env)
|
||||
try:
|
||||
vrs, account, container, obj = req.split_path(4, 4, True)
|
||||
is_obj_req = True
|
||||
except ValueError:
|
||||
is_obj_req = False
|
||||
if not is_obj_req:
|
||||
return self.app(env, start_response)
|
||||
|
||||
if ((req.method == 'GET' or req.method == 'HEAD') and
|
||||
|
@ -128,6 +128,10 @@ class ListingFilter(object):
|
||||
# account and container only
|
||||
version, acct, cont = req.split_path(2, 3)
|
||||
except ValueError:
|
||||
is_container_req = False
|
||||
else:
|
||||
is_container_req = True
|
||||
if not is_container_req:
|
||||
return self.app(env, start_response)
|
||||
|
||||
if not valid_api_version(version) or req.method not in ('GET', 'HEAD'):
|
||||
|
@ -119,7 +119,11 @@ class ListingEtagMiddleware(object):
|
||||
if not valid_api_version(v):
|
||||
raise ValueError
|
||||
except ValueError:
|
||||
# not a container request; pass through
|
||||
is_container_req = False
|
||||
else:
|
||||
is_container_req = True
|
||||
if not is_container_req:
|
||||
# pass through
|
||||
return self.app(env, start_response)
|
||||
|
||||
ctx = WSGIContext(self.app)
|
||||
|
@ -1511,7 +1511,10 @@ class StaticLargeObject(object):
|
||||
req = Request(env)
|
||||
try:
|
||||
vrs, account, container, obj = req.split_path(3, 4, True)
|
||||
is_cont_or_obj_req = True
|
||||
except ValueError:
|
||||
is_cont_or_obj_req = False
|
||||
if not is_cont_or_obj_req:
|
||||
return self.app(env, start_response)
|
||||
|
||||
if not obj:
|
||||
|
@ -551,7 +551,10 @@ class SymlinkMiddleware(object):
|
||||
req = Request(env)
|
||||
try:
|
||||
version, acc, cont, obj = req.split_path(3, 4, True)
|
||||
is_cont_or_obj_req = True
|
||||
except ValueError:
|
||||
is_cont_or_obj_req = False
|
||||
if not is_cont_or_obj_req:
|
||||
return self.app(env, start_response)
|
||||
|
||||
try:
|
||||
|
@ -814,7 +814,10 @@ class VersionedWritesMiddleware(object):
|
||||
req = Request(env)
|
||||
try:
|
||||
(api_version, account, container, obj) = req.split_path(3, 4, True)
|
||||
is_cont_or_obj_req = True
|
||||
except ValueError:
|
||||
is_cont_or_obj_req = False
|
||||
if not is_cont_or_obj_req:
|
||||
return self.app(env, start_response)
|
||||
|
||||
# In case allow_versioned_writes is set in the filter configuration,
|
||||
|
Loading…
x
Reference in New Issue
Block a user