コード例 #1
0
ファイル: Site.py プロジェクト: amila/guslaboo
    def GetAll():
        from Database import Redis
        r = Redis()
        members = r.get_range('users',0,-1)
        list_of_members = list()
        for member in members:
            p = Person(member)
            p._id = r.get(Person.key + ':' +member+':id')
            points = r.get(Person.key +':' + member + ':points')

            if(points != None):
                self.points = points

            list_of_members.append(p)

        return list_of_members
コード例 #2
0
ファイル: Site.py プロジェクト: amila/guslaboo
    def GetAll():
        from Database import Redis
        r = Redis(use_pipeline=True)

        challenges = r.get_set(Challenge.set_key +':not_awarded',True)

        for challenge in challenges:
            r.echo(challenge.partition(':')[2])
            r.get(challenge +':challenged')
            r.get(challenge +':points')
            r.get(challenge +':message')

        challenge_objs = r.execute_pipe()
        print challenge_objs
        list_of_challenges = list()
        i =0
        c = None
        for row in challenge_objs:
            if i % 4 == 0:
                if c != None:
                    list_of_challenges.append(c)
                c = Challenge()
                c._id = row
            elif i % 4 == 1:
                c.challenged = row
            elif i % 4 == 2:
                c.points = row
            elif i % 4 == 3:
                c.message = row

            i = i+1
        if c != None:
            list_of_challenges.append(c)

        return list_of_challenges