aboutsummaryrefslogtreecommitdiffstats
path: root/moon_orchestrator/moon_orchestrator/http_server.py
diff options
context:
space:
mode:
authorAsteroide <thomas.duval@orange.com>2018-10-05 15:01:17 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-10-05 15:01:17 +0000
commitcbea4e360e9bfaa9698cf7c61c83c96a1ba89b8c (patch)
treea8bf6a7bfb06605ed5bfab77570afbe1e46cff4b /moon_orchestrator/moon_orchestrator/http_server.py
parenta3f68df52836676b23ac0f5e3d8c40c957ee80a7 (diff)
parent2e35a7e46f0929438c1c206e3116caa829f07dc6 (diff)
Merge "Update code to 4.6 official version"
Diffstat (limited to 'moon_orchestrator/moon_orchestrator/http_server.py')
-rw-r--r--moon_orchestrator/moon_orchestrator/http_server.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/moon_orchestrator/moon_orchestrator/http_server.py b/moon_orchestrator/moon_orchestrator/http_server.py
index 1cb12618..72e12358 100644
--- a/moon_orchestrator/moon_orchestrator/http_server.py
+++ b/moon_orchestrator/moon_orchestrator/http_server.py
@@ -19,7 +19,7 @@ logger = logging.getLogger("moon.orchestrator.http_server")
__API__ = (
Status,
- )
+)
class Server:
@@ -70,7 +70,7 @@ class Root(Resource):
"""
The root of the web service
"""
- __urls__ = ("/", )
+ __urls__ = ("/",)
__methods = ("get", "post", "put", "delete", "options")
def get(self):
@@ -136,10 +136,12 @@ class HTTPServer(Server):
def get_404_json(e):
return jsonify({"result": False, "code": 404, "description": str(e)}), 404
+
self.app.register_error_handler(404, get_404_json)
def get_400_json(e):
return jsonify({"result": False, "code": 400, "description": str(e)}), 400
+
self.app.register_error_handler(400, lambda e: get_400_json)
self.app.register_error_handler(403, exceptions.AuthException)
@@ -163,4 +165,3 @@ class HTTPServer(Server):
@staticmethod
def __filter_str(data):
return data.replace("@", "-")
-