示例#1
0
def create_school(competition, area, size, conference, school_name):
    school = Schools( **dict(request.data.items() + request.view_args.items()) )
    school._id = ObjectId()
    school.wrestlers = dict([ ( wrestler.get('wrestler_id'), wrestler_object(Wrestler(**wrestler))) for wrestler in school.wrestlers])
    school.save()
    redis_save(remove_OIDs(school), school.school_name, value_fields=(school.competition, school.area, school.size, 
        school.conference), store_func='rpush')
    defined_school = redis_cli.hset('coach_confirmation', uuid.uuid4(), school.mongo_id)
    return json.dumps( school, default=remove_OIDs )
示例#2
0
def get_static_data(static_key):
    if bool(request.args.get('qrefresh')):
        redis_cli.set('school_hash', pickle.dumps({}) )    
        [ redis_save(remove_OIDs(school), school.school_name, value_fields=(school.competition, school.area, school.size, 
            school.conference), store_func='rpush')
            for school in mongo_q()]
    lookup_value = redis_cli.get(static_key)
    lookup_value = pickle.loads(lookup_value) if lookup_value is not None else {}
    log.debug("GOt back a pickle: %s " % lookup_value)
    return json.dumps( lookup_value, default=remove_OIDs )