Beispiel #1
0
import yate
import athletemodel

athletes = athletemodel.get_namesID_from_store()

print(yate.start_response())

print(yate.include_header("NUAC's List of Athletes"))

print(yate.start_form("generate_timing_data.py"))

print(yate.para_text("Select an athlete from the list to work with:"))

for each_athlete in athletes:
    # Now athletes are list of lists
    # so amending the code to get the data.
    print(yate.radio_button_id("which_athlete",
                               each_athlete[0], each_athlete[1]))

print(yate.end_form("Select"))

print(yate.include_footer({"Home": "/index.html"}))
import cgi
import athletemodel
import yate

athletes = athletemodel.get_from_store()

# Here cgi module is used to access the form data coming from genrate_list.py
# which athlete data you are working with
# Web server send us the data to CGI Script(from genrate_list.py)
# Grab all the form data and put it in dictionary

form_data = cgi.FieldStorage()

# Access the named piece of data from the form's data.
athlete_name = form_data['which_athlete'].value

print(yate.start_response())

print(yate.include_header("Coach Kelly Timing Data"))

print(yate.header("Athlete: " + athlete_name + " " +
                  ', dob:' + athletes[athlete_name].dob + "."))

print(yate.para_text("The top Three times for the Athletes"))

print(yate.u_list(athletes[athlete_name].top3))

print(yate.include_footer({"Home": "/index.html",
                           "Select another athlete": "generate_list.py"}))
form_data = cgi.FieldStorage()

# Access the named piece of data from the form's data.
athlete_id = form_data['which_athlete'].value

athletes = athletemodel.get_athlete_from_id(athlete_id)

# Here cgi module is used to access the form data coming from genrate_list.py
# which athlete data you are working with
# Web server send us the data to CGI Script(from genrate_list.py)
# Grab all the form data and put it in dictionary


print(yate.start_response())

print(yate.include_header("NUAC's Timing Data"))

print(yate.header("Athlete: " + athletes['Name'] + " " +
                  ', DOB:' + athletes['DOB'] + "."))

print(yate.para_text("The Top Three times for the Athletes are:"))

print(yate.u_list(athletes['top3']))

print(yate.para_text("The entire set of timing data is: " +
                     str(athletes['data']) + " (duplicates removed)."))

print(yate.include_footer({"Home": "/index.html",
                           "Select another athlete": "generate_list.py"}))