Beispiel #1
0
    def mc_get_list(cls, id_list):
        id_list = tuple(id_list)
        mc_key = cls.Meta.mc_key
        result = mc.get_dict_marshal([mc_key%i for i in id_list], cls._loads)
        r = []
        for i in id_list:
            t = result.get(mc_key%i)
            if t is None:
                if i:
                    t = cls.get(i)
                    if t:
                        t.mc_set()
            r.append(t)

        return r
Beispiel #2
0
    def mc_get_list(cls, id_list):
        id_list = tuple(id_list)
        mc_key = cls.Meta.mc_key
        result = mc.get_dict_marshal([mc_key % i for i in id_list], cls._loads)
        r = []
        for i in id_list:
            t = result.get(mc_key % i)
            if t is None:
                if i:
                    t = cls.get(i)
                    if t:
                        t.mc_set()
            r.append(t)

        return r
Beispiel #3
0
 def mc_get_dict(cls, id_list):
     if type(id_list) not in (array, list, tuple, dict):
         id_list = tuple(id_list)
     mc_key = cls.Meta.mc_key
     result = mc.get_dict_marshal([mc_key%i for i in id_list], cls._loads)
     r = {}
     for i in id_list:
         t = result.get(mc_key%i)
         if t is None:
             if i:
                 t = cls.get(i)
                 if t:
                     t.mc_set()
         r[i] = t
     return r
Beispiel #4
0
 def mc_get_dict(cls, id_list):
     if type(id_list) not in (array, list, tuple, dict):
         id_list = tuple(id_list)
     mc_key = cls.Meta.mc_key
     result = mc.get_dict_marshal([mc_key % i for i in id_list], cls._loads)
     r = {}
     for i in id_list:
         t = result.get(mc_key % i)
         if t is None:
             if i:
                 t = cls.get(i)
                 if t:
                     t.mc_set()
         r[i] = t
     return r