From b1083b47f7c3ecfcfd1e546aafffe0c71f674316 Mon Sep 17 00:00:00 2001 From: "robin.keunen" Date: Thu, 27 Aug 2020 17:02:48 +0200 Subject: [PATCH] [IMP] emca: add validate route --- easy_my_coop_api/controllers/controllers.py | 10 ++++++++++ easy_my_coop_connector/components/emc_backend.py | 14 ++------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/easy_my_coop_api/controllers/controllers.py b/easy_my_coop_api/controllers/controllers.py index 8badeb2..1528d22 100644 --- a/easy_my_coop_api/controllers/controllers.py +++ b/easy_my_coop_api/controllers/controllers.py @@ -23,3 +23,13 @@ class UserController(main.RestController): return self._process_method( _service_name, "test", _id=None, params=None ) + + @route( + _root_path + "//validate", + methods=["POST"], + csrf=False, + ) + def validate(self, _service_name, _id, **params): + return self._process_method( + _service_name, "validate", _id=_id, params=params + ) diff --git a/easy_my_coop_connector/components/emc_backend.py b/easy_my_coop_connector/components/emc_backend.py index 116f661..f32991d 100644 --- a/easy_my_coop_connector/components/emc_backend.py +++ b/easy_my_coop_connector/components/emc_backend.py @@ -53,12 +53,7 @@ class EMCBackend(models.Model): return json.loads(content) elif response.status_code == 400: content = response.content.decode("utf-8") - raise BadRequest( - _( - "request returned status code %s with message %s" - % (response.status_code, content) - ) - ) + raise BadRequest("%s" % content) elif response.status_code == 403: raise AccessDenied( _("You are not allowed to access this resource") @@ -69,12 +64,7 @@ class EMCBackend(models.Model): ) else: # 500 et al. content = response.content.decode("utf-8") - raise InternalServerError( - _( - "request returned status code %s with message %s" - % (response.status_code, content) - ) - ) + raise InternalServerError(_("%s" % content)) @api.multi def http_get_content(self, url, params=None, headers=None):