From 2e35a7e46f0929438c1c206e3116caa829f07dc6 Mon Sep 17 00:00:00 2001 From: Thomas Duval Date: Fri, 5 Oct 2018 16:54:37 +0200 Subject: Update code to 4.6 official version Change-Id: Ibd0da0e476e24b2685f54693efc11f7a58d40a62 --- moon_orchestrator/moon_orchestrator/http_server.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'moon_orchestrator/moon_orchestrator/http_server.py') 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("@", "-") - -- cgit 1.2.3-korg