Page 273 -
P. 273
web development
Pool Puzzle
Your job is to take the code from the pool and
place them into the blank lines in the CGI
script. You may not use the same line
of code more than once. Your goal is to
make a CGI script that will generate a
HTML page that matches the hand-drawn
design from the previous page.
Import the modules that you need. You’ve
I’ve started import athletemodel already met “athletemodel” and “yate”.
things off import yate The “glob” module lets you query your
for you. import glob operating system for a list of file names.
Use your “put_to_store()” function
data_files = glob.glob("data/*.txt") to create a dictionary of athletes
athletes = athletemodel.put_to_store(data_files) from the list of data files.
Let’s add a link to
the bottom of the
generated HTML
page that takes
your user home.
print(yate.include_footer({"Home": "/index.html"}))
Note: each thing from
the pool can be used
once! print(yate.start_form("generate_timing_data.py"))
print(yate.para("Select an athlete from the list to work with:"))
for each_athlete in athletes:
print(yate.include_header("Coach Kelly's List of Athletes"))
print(yate.start_response()) print(yate.end_form("Select"))
print(yate.radio_button("which_athlete", athletes[each_athlete].name))
you are here 4 237