Ejemplo n.º 1
0
 def getObjList(self, pklist):
     '''根据主键列表获取mmode对象的列表.\n
     >>> m = madmin.getObjList([1,2,3,4,5])
     '''
     _pklist = []
     objlist = []
     for pk in pklist:
         mm = MMode(self._name + ':%s' % pk,
                    self.pk,
                    fk=self._fk,
                    timeout=self.timeout)
         if not mm.IsEffective():
             continue
         if mm.get('data'):
             objlist.append(mm)
         else:
             _pklist.append(pk)
     if _pklist:
         recordlist = util.GetRecordList(self._name, self.pk, _pklist)
         for record in recordlist:
             pk = record[self.pk]
             mm = MMode(self._name + ':%s' % pk,
                        self.pk,
                        data=record,
                        fk=self._fk,
                        timeout=self.timeout)
             mm.insert()
             objlist.append(mm)
     return objlist
Ejemplo n.º 2
0
 def getObjList(self, pklist):
     """
     """
     _pklist = []
     objlist = []
     for pk in pklist:
         mm = MMode(self._name + ':%s' % pk, self._pk)
         if not mm.IsEffective():
             continue
         if mm.get('data'):
             objlist.append(mm)
         else:
             _pklist.append(pk)
     if _pklist:
         recordlist = util.GetRecordList(self._name, self._pk, _pklist)
         for record in recordlist:
             pk = record[self._pk]
             mm = MMode(self._name + ':%s' % pk, self._pk, data=record)()
             objlist.append(mm)
     return objlist