Пример #1
0
def show_school_info(competition, area, size, conference, school_name):
    log.debug( "Got a request for finding school: "+ school_name)
    try:
        school = find_school(**request.view_args)
        return json.dumps( school, default=remove_OIDs )
    except:
        log.error("Unexpected error:", sys.exc_info()[0])
        raise
Пример #2
0
def create_wrestler(competition, area, size, conference, school_name):
    school = find_school(**request.view_args)
    json_data = request.data
    wrestler = Wrestler( **json_data )
    wrestler = wrestler_object(wrestler)
    try:
        school.__getattribute__("wrestlers")
    except AttributeError: 
        school.wrestlers = {}
    wrestler_dict = school.wrestlers
    wrestler_dict[wrestler.wrestler_id] = wrestler
    school.wrestlers = wrestler_dict
    school.save()
    return json.dumps( school, default=remove_OIDs )
Пример #3
0
def show_wrestler_info(competition, area, size, conference, school_name, wrestler_id):
    school = find_school(**request.view_args)
    wrestler = school.wrestlers.get(ObjectId(wrestler_id),
            None)
    return json.dumps( wrestler, default=remove_OIDs )
Пример #4
0
def show_all_wrestlers(competition, area, size, conference, school_name):
    school = find_school(**request.view_args)
    return json.dumps( school.wrestlers.values(), default=remove_OIDs )