From c89068117b3dafe24b6776a99b02018dd685c3dd Mon Sep 17 00:00:00 2001 From: Nikolaj Starodubtsev Date: Wed, 30 Oct 2013 13:38:34 +0400 Subject: [PATCH] Small fix for climate.api.utils Add changes in climate.api.utils The bug occured because function excecution wasn't stop after we log an error with abort_and_log func. Fix it with adding return statement after abort_and_log. Fixes LP bug #1246244 Change-Id: I7351758c10163c01ed55ffe6028dac63f9d70c69 --- climate/api/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/climate/api/utils.py b/climate/api/utils.py index 3d63bfbf..6bdbd3f2 100644 --- a/climate/api/utils.py +++ b/climate/api/utils.py @@ -111,6 +111,7 @@ def render(result=None, response_type=None, status=None, **kwargs): elif kwargs: # can't merge kwargs into the non-dict res abort_and_log(500, "Non-dict and non-empty kwargs passed to render.") + return status_code = getattr(flask.request, 'status_code', None) if status: @@ -127,8 +128,10 @@ def render(result=None, response_type=None, status=None, **kwargs): serializer = wsgi.JSONDictSerializer() else: abort_and_log(400, "Content type '%s' isn't supported" % response_type) + return body = serializer.serialize(result) + response_type = str(response_type) return flask.Response(response=body, status=status_code, @@ -153,6 +156,7 @@ def request_data(): deserializer = wsgi.JSONDeserializer() else: abort_and_log(400, "Content type '%s' isn't supported" % content_type) + return # parsed request data to avoid unwanted re-parsings parsed_data = deserializer.deserialize(flask.request.data)['body']