コード例 #1
0
ファイル: EmailManager.py プロジェクト: RDTeam/openconvirt
 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
コード例 #2
0
ファイル: EmailManager.py プロジェクト: gladmustang/cloudvirt
 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
コード例 #3
0
ファイル: UpdateManager.py プロジェクト: RDTeam/openconvirt
    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()
コード例 #4
0
    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()