diff options
author | asteroide <thomas.duval@orange.com> | 2017-05-03 10:52:19 +0200 |
---|---|---|
committer | asteroide <thomas.duval@orange.com> | 2017-05-03 10:52:19 +0200 |
commit | bbd3dd78e209225c86ac71107a9d55d5d7615ad6 (patch) | |
tree | 77d9b1ee482811c79ccbdd4b64fa93ea2db1d167 /moonv4/moon_manager | |
parent | 6ca63399c475f534b9fa533f38e5642fc2122c44 (diff) |
Allow ID to be optional in certain cases
Change-Id: Ia03bdc5bc79b6a2061b6d5381c9ad3273f388aac
Diffstat (limited to 'moonv4/moon_manager')
-rw-r--r-- | moonv4/moon_manager/moon_manager/api/models.py | 4 | ||||
-rw-r--r-- | moonv4/moon_manager/moon_manager/api/policies.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/moonv4/moon_manager/moon_manager/api/models.py b/moonv4/moon_manager/moon_manager/api/models.py index 6cb81439..56695c17 100644 --- a/moonv4/moon_manager/moon_manager/api/models.py +++ b/moonv4/moon_manager/moon_manager/api/models.py @@ -18,7 +18,7 @@ class Models(object): def get_models(self, ctx, args): try: - data = self.manager.get_models(user_id=ctx["user_id"], model_id=ctx["id"]) + data = self.manager.get_models(user_id=ctx["user_id"], model_id=ctx.get("id")) except Exception as e: LOG.error(e, exc_info=True) return {"result": False, @@ -28,7 +28,7 @@ class Models(object): def add_model(self, ctx, args): try: - data = self.manager.add_model(user_id=ctx["user_id"], model_id=ctx["id"], value=args) + data = self.manager.add_model(user_id=ctx["user_id"], model_id=ctx.get("id"), value=args) except Exception as e: LOG.error(e, exc_info=True) return {"result": False, diff --git a/moonv4/moon_manager/moon_manager/api/policies.py b/moonv4/moon_manager/moon_manager/api/policies.py index 8b242478..88c762a4 100644 --- a/moonv4/moon_manager/moon_manager/api/policies.py +++ b/moonv4/moon_manager/moon_manager/api/policies.py @@ -18,7 +18,7 @@ class Policies(object): def get_policies(self, ctx, args): try: - data = self.manager.get_policies(user_id=ctx["user_id"], policy_id=ctx["id"]) + data = self.manager.get_policies(user_id=ctx["user_id"], policy_id=ctx.get("id")) except Exception as e: LOG.error(e, exc_info=True) return {"result": False, @@ -28,7 +28,7 @@ class Policies(object): def add_policy(self, ctx, args): try: - data = self.manager.add_policy(user_id=ctx["user_id"], policy_id=ctx["id"], value=args) + data = self.manager.add_policy(user_id=ctx["user_id"], policy_id=ctx.get("id"), value=args) except Exception as e: LOG.error(e, exc_info=True) return {"result": False, |