From 41ac4c4e9a6112d8c98472a1be60e4869814f549 Mon Sep 17 00:00:00 2001 From: Koren Lev Date: Sun, 15 Oct 2017 01:38:44 +0300 Subject: added schemes to support new ui link options + fix api per new schemes Change-Id: I768233f13749d01d436c24c764cb903ca19d3d2a Signed-off-by: Koren Lev --- app/api/responders/resource/clique_types.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'app/api/responders/resource/clique_types.py') diff --git a/app/api/responders/resource/clique_types.py b/app/api/responders/resource/clique_types.py index a2bfa75..ff42f8c 100644 --- a/app/api/responders/resource/clique_types.py +++ b/app/api/responders/resource/clique_types.py @@ -13,17 +13,17 @@ from bson.objectid import ObjectId class CliqueTypes(ResponderBase): - def __init__(self): - super().__init__() - self.COLLECTION = "clique_types" - self.ID = "_id" - self.PROJECTION = { - self.ID: True, - "focal_point_type": True, - "link_types": True, - "environment": True, - "name": True - } + + COLLECTION = "clique_types" + ID = "_id" + PROJECTION = { + ID: True, + "focal_point_type": True, + "link_types": True, + "environment": True, + "name": True + } + RESERVED_NAMES = ["ANY"] def on_get(self, req, resp): self.log.debug("Getting clique types") @@ -83,7 +83,9 @@ class CliqueTypes(ResponderBase): env_name = clique_type['environment'] if not self.check_environment_name(env_name): - self.bad_request("unknown environment: " + env_name) + self.bad_request("Unknown environment: {}".format(env_name)) + elif env_name.upper() in self.RESERVED_NAMES: + self.bad_request("Environment name '{}' is reserved".format(env_name)) self.write(clique_type, self.COLLECTION) self.set_successful_response(resp, -- cgit 1.2.3-korg