def get(self): # page for class p = Page() lib = FavoriteMovies() #use form to get this info #movie title #movie year #director md1 = MovieData() md1.title = "Star Wars" md1.year = 1989 md1.director = "George Lucas" lib.add_movie(md1) md2 = MovieData() md2.title = "Forrest Gump" md2.year = 1999 md2.director = "Pedro Lopez" lib.add_movie(md2) lib.calc_time_span() p.body = lib.compile_list() + lib.calc_time_span() self.response.write(p.print_out())
def get(self): p = Page() lib = FavoriteMovies() #movie title #year the movie was made #director of the film md1 = MovieData() md1.title = "The Princess Bride" md1.year = 1989 #this is actually calling a function md1.director = "Rob Reiner" lib.add_movie(md1) md2 = MovieData() md2.title = "Dune" md2.year = 1986 #this is actually calling a function md2.director = "David Lynch" lib.add_movie(md2) md3 = MovieData() md3.title = "Star Wars" md3.year = 1977 #this is actually calling a function md3.director = "George Lucas" lib.add_movie(md3) #lib.movie_list = [md1, md2] you could do this if it was public p.body = lib.compile_list() + lib.calc_time_span() #change the body before it prints it out - lib.compile list is outputting the string and going it the atribute we have in that class - now the html code will show self.response.write(p.print_out())
def get(self): #page for class p = Page() lib = FavoriteMovies() #lib object #movie title #year movie was made #director of film md1 = MovieData() md1.title = "The Princess Bride" md1.year = 1989 #calling a function md1.director = "Rob Reiner" lib.add_movie(md1) md2 = MovieData() md2.title = "Dune" md2.year = 1986 #calling a function md2.director = "David Lynch" lib.add_movie(md2) md2 = MovieData() md2.title = "Star Wars" md2.year = 1977 #calling a function md2.director = "George Lucas" lib.add_movie(md2) p.body = lib.compile_list() + lib.calc_time_span() #lib.movie_list = [md1, md2] = if it was public self.response.write(p.print_out())
def get(self): #page for class p = Page() lib = FavoriteMovies() #movie title #year movie was made #director of the film md1 = MovieData() md1.title = "The Princess Bride" md1.year = 1989 #actually calling a function md1.director = "Rob Reiner" lib.add_movie(md1) md2 = MovieData() md2.title = "Dune" md2.year = 1986 #actually calling a function md2.director = "David Lynch" lib.add_movie(md2) md2 = MovieData() md2.title = "Star wars" md2.year = 1977 #actually calling a function md2.director = "George Lucas" lib.add_movie(md2) p.body = lib.compile_list() + lib.calc_time_span() self.response.write(p.print_out()) def main(name, GPA): print "The GPA for", name,"is",GPA return 0
def get(self): p = Page() lib = FavoriteMovies() #instance for the FavoriteMovies #movie title (this is part of our assignment, making it user input) #year movie was made(this is part of our assignment)(this is our assignment) #director of the film (this is part of our assignment) #for this demo we will be hard-coding the above three line values do not normally do this #page for class (if/else for 2 different page views for assignment) md1 = MovieData() md1.title = "The Princess Bride" md1.year = 1989 #actually calling a function md1.director = "Rob Reiner" md2 = MovieData() md2.title = "Dune" md2.year = 1986 #actually calling a function md2.director = "David Lynch" md3 = MovieData() md3.title = "Star Wars" md3.year = 1977 #actually calling a function md3.director = "George Lucas" #lib.calc_time_span() #adds this to run but we need to add it to the printing out list below p.body = lib.compile_list() + lib.calc_time_span() #adds the compile list to the body tag of the html in the page.py self.response.write(p.print_out()) #sends the info out to browser as a big string
def get(self): p = Page() lib = FavoriteMovies() #USER ENTRY #Movie Title #Year Made #Directory md1 = MovieData() md1.title = "The Princess Bride" md1.director = "Rob Reiner" md1.year = 1989 lib.add_movie(md1) md2 = MovieData() md2.title = "Dune" md2.director = "David Lynch" md2.year = 1986 lib.add_movie(md2) md3 = MovieData() md3.title = "Star Wars" md3.director = "George Lucas" md3.year = 1977 lib.add_movie(md3) p.body = lib.compile_list() self.response.write(p.print_out(p.body, lib.calc_time_span()))