Browse Source

[IMP] emca: add validate route

pull/115/head
robin.keunen 4 years ago
parent
commit
b1083b47f7
  1. 10
      easy_my_coop_api/controllers/controllers.py
  2. 14
      easy_my_coop_connector/components/emc_backend.py

10
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 + "<string:_service_name>/<int:_id>/validate",
methods=["POST"],
csrf=False,
)
def validate(self, _service_name, _id, **params):
return self._process_method(
_service_name, "validate", _id=_id, params=params
)

14
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):

Loading…
Cancel
Save