def get(self): p = Page() p.title = "My Page" p.css = "css/style.css" p.body = "this is the body" self.response.write(p.whole_page)
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()))
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() p.title = "My page!" p.css = "css/style.css" p.body = "Miss Piggy likes Kermit De Frog! " #p.update() self.response.write(p.whole_page)
def get(self): p = Page( ) #set our Page() class equal to p, this makes it easier to type out page_head = p.head #set the self.head attribute in Page() equal to the variable page_head for later use page_form = p.form #set the self.form attribute in Page() equal to the variable page_form for later use page_close = p.close #set the self.close attribute in Page() equal to the variable page_close for later use page_results = p.results #set the self.results attribute in Page() equal to the variable page_results for later use if self.request.GET: #start the if/else that will determine what to write to the browser depending on user input or lack of input, in this case, when user inputs we: username = self.request.GET[ 'su_name'] #set the input value of the form field su_name equal to username god = self.request.GET[ 'fav_god'] #set the input value of the form field fav_god equal to username role = self.request.GET[ 'role'] #set the input value of the form field role equal to username mode = self.request.GET[ 'game_mode'] #set the input value of the form field game_mode equal to username self.response.write(page_head + page_results + "<p class='results'>" + username + " | " + god + " | " + role + " | " + mode + "</p>" + page_close) #In the above line, we concatenate everything we want the page to write if the user has entered input. #We write the page_head html, followed by the page_results html, then we write the entered username/god/role/mode and wrap it in a <p> tag #with a class of 'results'. Finally, we add the page_close html, completing the web page. else: self.response.write(page_head + page_form + page_close)
def get(self): p = Page() p.title = "My page" p.css = "css/styles.css" p.body = "Miss Piggy like Kermit De Frog" self.response.write(p.whole_page)
def get(self): #self.response.write('Hello world!') p = Page() p.title = "My Page" p.css = "css/style.css" p.body = "This is Stacy's Python Example" #self.response.write(p.print_out()) p.update() self.response.write(p.whole_page)
def categorization(): category_filename = f'{blog.output_path}/categories' category_path = Path(category_filename) category_path.mkdir(parents=True, exist_ok=True) write_page(f'{category_path}/all.html', Page(template='categories.html', topic_list=[c for c in blog.categories]).html) for category in blog.categories: write_page(f'{category_path}/{category}.html', Page(template='blog_list.html', post_list=blog.categories[category], output_path=blog.output_path).html) tag_path = Path(f'{blog.output_path}/tag') tag_path.mkdir(parents=True, exist_ok=True) write_page(f'{tag_path}/all.html', Page(template='categories.html', topic_list=[t for t in blog.tags]).html) for tag in blog.tags: write_page(f'{tag_path}/{tag}.html', Page(template='blog_list.html', post_list=blog.categories[category], output_path=blog.output_path).html)
def set_home_page(self): """ Clean previous pages and create home page and render it to the screen :return: None """ self.refresh() body = Page(self.main_frame.frame) body.add_object(tk.Label, text='HI welcome to Learning Log', font=body.font, width=50) body.apply() self.main_frame.update(body.name)
def get(self): #Pull in the page class and store it. page = Page() #If there is a GET request store the variables from GET and write page. if self.request.GET: #NAME VARIABLES fname = self.request.GET['fname'] #First Name lname = self.request.GET['lname'] #Last Name name = fname + ' ' + lname #Concat first and last name #TITLE VARIABLE title = self.request.GET['job_title'] #Title #If title is empty insert a page break. if title == "": title = "<br>" #CONTACT VARIABLES email = self.request.GET['email'] #Email #PHONE NUMBER PARTS phone1 = self.request.GET['phone1'] #Phone section 1 phone2 = self.request.GET['phone2'] #Phone section 2 phone3 = self.request.GET['phone3'] #Phone section 3 phone_style = self.request.GET[ 'phone_sep'] #Formatting style for phone number #Check for the phone style type and store the results as phone if phone_style == "classic": #Format as classic phone = "(" + str(phone1) + ") " + str(phone2) + "-" + str( phone3) elif phone_style == "dot": #Format with dot phone = str(phone1) + "." + str(phone2) + "." + str(phone3) elif phone_style == "dash": #Format with dash phone = str(phone1) + "-" + str(phone2) + "-" + str(phone3) #ADDRESS PARTS street = self.request.GET['street'] #Street Address city = self.request.GET['city'] #City zip_code = self.request.GET['zip_code'] #Zip Code #Concat city and zip code. city = city + ' ' + zip_code #Pull in the card page template from the page class. card_page = page.card_page #Format the template with the locals provided by GET card_page = card_page.format(**locals()) #Write the card_page variable to the page. self.response.write(card_page) #If no GET write the form page. else: #Pull in the form pagefrom the page class. form_page = page.form_page #Write the form_page variable to the page. self.response.write(form_page)
def get(self): if self.request.GET: # if you can get these items then print this material first = self.request.GET['first'] # this is storing form info in a variable and then using that info for printing last = self.request.GET['last'] # this is storing form info in a variable and then using that info for printing email = self.request.GET['email'] # this is storing form info in a variable and then using that info for printing radio = self.request.GET['gender'] # this is storing form info in a variable and then using that info for printing check = self.request.GET['experience'] # this is storing form info in a variable and then using that info for printing select = self.request.GET['education'] # this is storing form info in a variable and then using that info for printing number = self.request.GET['quantity'] # this is storing form info in a variable and then using that info for printing self.response.write(first + ' ' + last + ' ' + email + ' ' + radio + ' ' + check + ' ' + select + ' ' + number) # this compiles all of the variable info from the form and prints it to the browser. else: p = Page() # this makes an instance of the page class from the pages.py file self.response.write(p.print_out()) # this prints it out to the window
def index(): links = (Link( name="Productivity In Tech", url="https://productivityintech.transistor.fm", image="https://s3-us-west-2.amazonaws.com/kjaymiller/images/pit-podcast.png", ), Link( name=".Net Core Show", url="https://dotnetcore.show", image="https://dotnetcore.show/content/images/2018/08/jamie-taylor-logo-podcast.svg" ), Link( name="Ask A Brit", url="https://askabrit.transistor.fm", image="https://kjaymiller.s3-us-west-2.amazonaws.com/images/AskABritv4.png" ) ) return Page(template='index.html', links=links).html
def get(self): p = Page() p.body = "Miss Piggy like Kermit De Frog" self.response.write(p.print_out())
def get(self): p = Page() p.title = "My page!" p.css = "css/style.css" p.body = "Hello World" self.response.write(p.whole_page)
def get(self): #self.response.write('Hello world!') p = Page() p.body = "This is Stacys Python Example" self.response.write(p.print_out())
def get(self): #Adding 4 placehodler products using the Products class and it's add_product method p1 = Product() p1.add_product("Shells & White Cheddar", "Annie's", 16.17, 4.5, "lb") p2 = Product() p2.add_product("Three Cheesy Mini-Shell Pasta", "Kraft", 9.73, 3.625, "lb") p3 = Product() p3.add_product("Organic Shells and Cheese", "Back to Nature", 3.11, 6, "oz") p4 = Product() p4.add_product("Shells & White Cheddar", "Pasta Roni", 1.00, 6.2, "oz") #Using the productData class to hold the products for the main page. products = productData() products.add_to_array(p1) products.add_to_array(p2) products.add_to_array(p3) products.add_to_array(p4) #Using the Page class to setup the beginnings of the HTML page. pg = Page() #Checking for GET, if GET render the compare products page, otherwise render the main page. if self.request.GET: #Using the producData class to hold products for the compare page. compare_products = productData() #Creating a new product with the CompareProduct class using the info from GET and add it to the compare_products instance of the productData class. new_product = CompareProduct() new_product.add_product(self.request.GET['pName'], self.request.GET['pBrand'], self.request.GET['pPrice'], self.request.GET['pWeight'], self.request.GET['pUnit']) compare_products.add_to_array(new_product) #For each product from the main page create a new instance of the CompareProduct class. for p in products.items: cp = CompareProduct() #Populate the cp instance with the information from the original products. cp.add_product(p.name, p.brand, p.price, p.weight, p.weight_unit) #Add it to the compare_products instance of the productData class. compare_products.add_to_array(cp) #Using the CompareHTML class create the compare_page instance. compare_page = CompareHTML() #For each of the compare_products items created a new_column instance of the compareColumn() class. for p in compare_products.items: new_column = compareColumn() #Create the column using the info from the compare_products item and the creat_column method from the compareColumn class. new_column.create_column(p) #Add it to the array in the compare_page that holds the columns using the add_product_method. compare_page.add_product_column(new_column) #Create the compare_html from the create_compare method in the compare_page instance of the CompareHTML class with the array of columns from the same instance. compare_html = compare_page.create_compare(compare_page) #Create the page HTML with the compare_page css and html using the create_page method from the pg instance of the Page() class. html = pg.create_page(compare_page.css, compare_html) #If no GET create the form page else: #Create an instance of the FormHTML class named form_page form_page = FormHTML() #Create the form_html from the creat_form method in the form_page instance of the FormHTML class with the array of columns from the same instance. form_html = form_page.create_form(products.items) #Create the page HTML with the form_page css and html using the create_page method from teh pg instance of the Page() class. html = pg.create_page(form_page.css, form_html) #Write the HTML to the page. self.response.write(html)
def get(self): h = hello() p = Page() p.title = "My New Page" p.css = "css/styles.css" p.update() #referencing my update class from pages h.update_this() # I will create an application that calculates the remaining storage for different users #now I will hard code the values for each data object m = Storage() m.pictures = 5 m.videos = 10 m.documents = 1 m.music = 3 m.apps = 4 #write the values to the page if self.request.GET: total = self.request.GET['totalStorage'] self.response.write(h.user_page_update + "Total storage used is " + total + " GB <br/> There is " + str(m.final_storage) + " GB of storage remaining") else: self.response.write(p.user_page) #writing the user_page which has has all the html for my application #now I am going create the remaining users #now I will hard code the values for each data object t = Storage() t.pictures = 10 t.videos = 10 t.documents = 1 t.music = 20 t.apps = 7 #write the values to the page # self.response.write(" <br/> Todd has " + str(t.final_storage) + " GB of storage remaining") #writing the user_page which has has all the html for my application #now I will hard code the values for each data object n = Storage() n.pictures = 1 n.videos = 4 n.documents = 1 n.music = 9 n.apps = 7 #write the values to the page # self.response.write(" <br/> Nancy has " + str(n.final_storage) + " GB of storage remaining") #writing the user_page which has has all the html for my application #now I will hard code the values for each data object h = Storage() h.pictures = 18 h.videos = 10 h.documents = 1 h.music = 6 h.apps = 7 #write the values to the page # self.response.write(" <br/> Henry has " + str(h.final_storage) + " GB of storage remaining") #writing the user_page which has has all the html for my application #now I will hard code the values for each data object j = Storage() j.pictures = 6 j.videos = 4 j.documents = 1 j.music = 7 j.apps = 2
def get(self): p = Page() p.body = "Hello World" self.response.write(p.print_out())
def get(self): p = Page() p.title = "MyPage" p.css = "css/styles.css" self.response.write(p.whole_page)
def get(self): p = Page() p.title = "My page!" p.css = "css/styles.css" p.update() self.response.write(p.whole_page)
def get(self): p = Page() self.response.write(p.print_out())
def set_home_page(self): self.main_frame.clean_page() body = Page(self.main_frame.frame) body.add_object(tk.Label, text='HI welcome to Learning Log', height=20, width=25) body.apply() self.main_frame.update(body.name)