def lookup_candidates_by_id():
    log("Getting all candidates")
    fs = Candidate.all().fetch(100)
    candidates_by_id = {}
    c = 0
    while fs:
        log("  getting batch from " + str(c))
        for f in fs:
            c = c + 1
            candidates_by_id[str(f.key())] = f
        fs = Candidate.all().filter('__key__ >', fs[-1].key()).fetch(100)
    return candidates_by_id
Ejemplo n.º 2
0
def lookup_candidates_by_id():
    log("Getting all candidates")
    fs = Candidate.all().fetch(100)
    candidates_by_id = {}
    c = 0
    while fs:
        log("  getting batch from " + str(c))
        for f in fs:
            c = c + 1
            candidates_by_id[str(f.key())] = f
        fs = Candidate.all().filter('__key__ >', fs[-1].key()).fetch(100)
    return candidates_by_id
Ejemplo n.º 3
0
    def RetrieveFirstGraph(self):

        c = memcache.get('initial_graph_seed')
        if c is None:
            c = Candidate.all()
            c = c.fetch(1)
            c = c[0]
            memcache.set('initial_graph_seed', c, time=7200)

        memkey = 'map::key_' + str(c.key()) + '::depth_' + str(
            settings.grapher_depth) + '::climit_' + str(
                settings.grapher_climit)
        map = memcache.get(memkey)
        map = None
        if map is None:
            map = mapObject(c, None, True, settings.grapher_depth,
                            settings.grapher_climit)
            memcache.set(memkey, map, time=7200)
        return {'result': 'success', 'response': map}