Skip to content
Snippets Groups Projects
Commit 9d9d3953 authored by Paul "LeoNerd" Evans's avatar Paul "LeoNerd" Evans
Browse files

Slightly reduce the insane amounts of indentation in main http server response...

Slightly reduce the insane amounts of indentation in main http server response path, by 'continue'ing around a non-match or falling through
parent dc4b774f
No related branches found
No related tags found
No related merge requests found
...@@ -124,27 +124,29 @@ class JsonResource(HttpServer, resource.Resource): ...@@ -124,27 +124,29 @@ class JsonResource(HttpServer, resource.Resource):
# and path regex match # and path regex match
for path_entry in self.path_regexs.get(request.method, []): for path_entry in self.path_regexs.get(request.method, []):
m = path_entry.pattern.match(request.path) m = path_entry.pattern.match(request.path)
if m: if not m:
# We found a match! Trigger callback and then return the continue
# returned response. We pass both the request and any
# matched groups from the regex to the callback. # We found a match! Trigger callback and then return the
# returned response. We pass both the request and any
args = [ # matched groups from the regex to the callback.
urllib.unquote(u).decode("UTF-8") for u in m.groups()
] args = [
urllib.unquote(u).decode("UTF-8") for u in m.groups()
logger.info( ]
"Received request: %s %s",
request.method, request.path logger.info(
) "Received request: %s %s",
request.method, request.path
code, response = yield path_entry.callback( )
request,
*args code, response = yield path_entry.callback(
) request,
*args
self._send_response(request, code, response) )
return
self._send_response(request, code, response)
return
# Huh. No one wanted to handle that? Fiiiiiine. Send 400. # Huh. No one wanted to handle that? Fiiiiiine. Send 400.
raise UnrecognizedRequestError() raise UnrecognizedRequestError()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment