def post(self): handler_para = UnSpecArticleFromBookPara(self) handler_json = UnSpecArticleFromBookJson(self) usr = self.current_user book = Catalog.by_id(handler_para['book_id']) relation_obj = Relation.by_id(handler_para['relation_id']) if book is None: handler_json.by_status(2) handler_json.write() return #book not exist if relation_obj is None: handler_json.by_status(1) handler_json.write() return #relation not exist auth_tmp = book.authority_verify(usr, env=book) if test_auth(auth_tmp, A_WRITE) is False: handler_json.by_status(4) handler_json.write() return #permission denied status = book.unspec_article_to(handler_para['node_id'], relation_obj) if status is False: handler_json.by_status(3) handler_json.write() return #set failed, node_id may not exist handler_json.by_status(0) handler_json.write() return #0
def post(self): handler_para = UnSpecArticleFromBookPara(self) handler_json = UnSpecArticleFromBookJson(self) usr = self.current_user book = Catalog.by_id(handler_para['book_id']) relation_obj = Relation.by_id(handler_para['relation_id']) if book is None: handler_json.by_status(2) handler_json.write() return #book not exist if relation_obj is None: handler_json.by_status(1) handler_json.write() return #relation not exist auth_tmp = book.authority_verify(usr, env=book) if test_auth(auth_tmp, A_WRITE) is False: handler_json.by_status(4) handler_json.write() return #permission denied status = book.unspec_article_to(handler_para['node_id'], relation_obj) if status is False: handler_json.by_status(3) handler_json.write() return #set failed, node_id may not exist handler_json.by_status(0) handler_json.write() return #0
def get_relation_to_catalog(self, catalog_obj, node_id): from relation import Relation tmp_lib = self.lib.relation_catalogs tmp = tmp_lib[catalog_obj.uid + '#' + node_id] if tmp is not None: return Relation.by_id(tmp) return None
def get_relation_to_catalog(self, catalog_obj, node_id): from relation import Relation tmp_lib = self.lib.relation_catalogs tmp = tmp_lib[catalog_obj.uid + "#" + node_id] if tmp is not None: return Relation.by_id(tmp) return None