def add_entity(self,name,entity_id, entityType ,parent): try: type=DBHelper().find_by_name(EntityType,entityType) e=Entity() e.name=name e.type=type e.entity_id=entity_id e.parent=parent DBHelper().add(e) except Exception, e: raise e
def add_entity(self, name, entity_id, entityType, parent): try: type = DBHelper().find_by_name(EntityType, entityType) e = Entity() e.name = name e.type = type e.entity_id = entity_id e.parent = parent DBHelper().add(e) except Exception, e: raise e
def set_updated_entities(self,entity_ids): node_ids=[] for entity_id in entity_ids.split(','): node_ids=self.merge_lists(node_ids,Entity.get_hierarchy(entity_id)) self.lock.acquire() try: for user in self.updated_entities.keys(): up_sessions = self.updated_entities.get(user,{}) for session,nodes in up_sessions.iteritems(): if len(nodes)>35: nodes=[] updated_nodes = self.merge_lists(nodes,node_ids) self.updated_entities[user][session] = updated_nodes finally: self.lock.release()
def set_updated_entities(self, entity_ids): node_ids = [] for entity_id in entity_ids.split(','): node_ids = self.merge_lists(node_ids, Entity.get_hierarchy(entity_id)) self.lock.acquire() try: for user in self.updated_entities.keys(): up_sessions = self.updated_entities.get(user, {}) for session, nodes in up_sessions.iteritems(): if len(nodes) > 35: nodes = [] updated_nodes = self.merge_lists(nodes, node_ids) self.updated_entities[user][session] = updated_nodes finally: self.lock.release()