Page 306 -
P. 306

athletemodel function




                                                 You were to add a new function to the athletemodel module
                                                 that, when called, returns the list of athlete names as a string.
                                                 You were to all the new function get_names_from_store().




                                def get_names_from_store():        Get all the data from the pickle.

                                    athletes = get_from_store()
              Extract a list
              of athlete names       response = [athletes[each_ath].name for each_ath in athletes]
              from the  data.
                                    return(response)

                                                       Return the list to the caller.










                                                      So...rather than running
                                                     a CGI script to create a HTML
                                                     web page, you want me to deliver
                                                    just the data, right? That’s OK. Not
                                                     a problem—just be sure to tell me
                                                     which script to run...











                                     Web
                                    Server












           270    Chapter 8
   301   302   303   304   305   306   307   308   309   310   311