def update(self, input, node_id, check_only=False): if node_id: try: node_id = int(node_id) except ValueError: raise ArgumentError("id must be integer") if "manifest" not in input or "value" not in input: raise MalformedInput("manifest or value not specified") d = dbBackend.update(node_id, input["manifest"], input["value"]) else: d = dbBackend.upsert(input, check_only=check_only) return d
def create(self, input, check_only=False): if isinstance(input, dict): if "manifest" not in input or "value" not in input: raise MalformedInput("manifest or value not specified") try: node_id = input.get("id", None) if node_id: node_id = int(node_id) except ValueError: raise ArgumentError("id must be integer") d = dbBackend.create(node_id, input["manifest"], input["value"]) else: d = dbBackend.upsert(input, True, check_only=check_only) return d