本文整理汇总了Python中pages.Page.print_out方法的典型用法代码示例。如果您正苦于以下问题:Python Page.print_out方法的具体用法?Python Page.print_out怎么用?Python Page.print_out使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pages.Page
的用法示例。
在下文中一共展示了Page.print_out方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from pages import Page [as 别名]
# 或者: from pages.Page import print_out [as 别名]
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
示例2: get
# 需要导入模块: from pages import Page [as 别名]
# 或者: from pages.Page import print_out [as 别名]
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())
示例3: get
# 需要导入模块: from pages import Page [as 别名]
# 或者: from pages.Page import print_out [as 别名]
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
示例4: get
# 需要导入模块: from pages import Page [as 别名]
# 或者: from pages.Page import print_out [as 别名]
def get(self):
p = Page()
lib = FavoriteMovies()
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
md2.director = "David Lynch"
lib.add_movie(md2)
md3 = MovieData()
md3.title = "Star Wars"
md3.year = 1977
md3.director = "George Lucus"
lib.add_movie(md3)
p.body = lib.compile_list() + lib.calc_time_span()
self.response.write(p.print_out())
示例5: get
# 需要导入模块: from pages import Page [as 别名]
# 或者: from pages.Page import print_out [as 别名]
def get(self):
p = Page()
p.body = "Miss Piggy is aweful!"
self.response.write(p.print_out())
示例6: get
# 需要导入模块: from pages import Page [as 别名]
# 或者: from pages.Page import print_out [as 别名]
def get(self):
p = Page() #instance of page
p.body = "Miss Piggy Likes Kermit De Frog!"
self.response.write(p.print_out()) #prints out to browser
示例7: get
# 需要导入模块: from pages import Page [as 别名]
# 或者: from pages.Page import print_out [as 别名]
def get(self):
p = Page()
self.response.write(p.print_out())
示例8: get
# 需要导入模块: from pages import Page [as 别名]
# 或者: from pages.Page import print_out [as 别名]
def get(self):
p = Page()
p.body = "Miss Piggy like Kermit De Frog!"
self.response.write(p.print_out())
示例9: get
# 需要导入模块: from pages import Page [as 别名]
# 或者: from pages.Page import print_out [as 别名]
def get(self):
p = Page()
p.body ="Miss Piggy likes Chocolate!" #modify's self.body
self.response.write(p.print_out())
示例10: get
# 需要导入模块: from pages import Page [as 别名]
# 或者: from pages.Page import print_out [as 别名]
def get(self):
#function defines attributes of five objects: s, n, f, j, m
#get function print_out to print html
#get function if statement that defines condition for printing class Delivered attributes
s = Delivered()#defines class delivered attributes for September
s.sale1 = 40#how much it cost each sales
s.sale2 = 69
s.sale3 = 36
s.sale4 = 89
s.sale5 = 24
s.calc_total()#function to calculate the total of September sales.
#"November" class delivered variables
n = Delivered()#defines class delivered attributes for November
n.sale1 = 50#how much it cost each sales
n.sale2 = 55
n.sale3 = 68
n.sale4 = 93
n.sale5 = 32
n.calc_total()#function to calculate the total of November sales.
#February delivered
f = Delivered()#defines class delivered attributes for February
f.sale1 = 24#how much it cost each sales
f.sale2 = 12
f.sale3 = 18
f.sale4 = 84
f.sale5 = 34
f.calc_total()#function to calculate the total of February sales.
j = Delivered()#defines class delivered attributes for June
j.sale1 = 50#how much it cost each sales
j.sale2 = 50
j.sale3 = 50
j.sale4 = 50
j.sale5 = 50
j.calc_total()#function to calculate the total of June sales.
#May delivered
m = Delivered()#defines class delivered attributes for May
m.sale1 = 50#how much it cost each sales
m.sale2 = 50
m.sale3 = 50
m.sale4 = 50
m.sale5 = 50
m.calc_total()#function to calculate the total of May sales.
#call class Page to print in this page
p = Page()
self.response.write(p.print_out())
#if the links are requested, it's print_out_data function called to print the data from the self.month
if self.request.GET:
#if we have September after name in url
if self.request.GET['name'] == 'september':
p.month_data = s #part of the html from class Page that holds the class Delivered attributes for each month
title ='s.title'
self.response.write(p.print_out_data())# call function print_out_data from class Page to print Delivered attributes.
#if we have November after name in url
elif self.request.GET ['name'] == 'november':
p.month_data = n
self.response.write('November' + p.print_out_data())
#if we have February after name in url
elif self.request.GET ['name'] == 'february':
p.month_data = f
self.response.write(p.print_out_data())
#if we have June after name in url
elif self.request.GET ['name'] == 'june':
p.month_data = j
self.response.write(p.print_out_data())
#if we have May after name in url
elif self.request.GET ['name'] == 'may':
p.month_data = m
self.response.write(p.print_out_data())
#if we don't find any of the names above after name in url, just print same page
else:
self.response.write(p.head + p.body + p.close)
#the print is empty to avoid the same page print twice.
else:
self.response.write('')
示例11: get
# 需要导入模块: from pages import Page [as 别名]
# 或者: from pages.Page import print_out [as 别名]
#.........这里部分代码省略.........
m.level = "Youth"
m.horses = 15
m.fee = 25.95
m.calc_price()
#self.response.write ("<br><br><strong>Name:</strong> " + m.name + "<br /><strong>Address:</strong> " + m.address + "<br /><strong>Phone:</strong> " + m.phone + "<br /><strong>Membership Level:</strong> " + m.level + "<br /><strong>Number of Horses Registered:</strong> " + str(m.horses) + "<br /><strong>Total Registration Fee:</strong> $" + str(m.final_price))
#Duke Registration
d = Registration()
d.name = "Duke"
d.address = "2905 Roland Avenue, Chambersburg, PA 17201"
d.phone = "555-234-6789"
d.level = "Amatuer"
d.horses = 1
d.fee = 75.95
d.calc_price()
#self.response.write ("<br><br><strong>Name:</strong> " + d.name + "<br /><strong>Address:</strong> " + d.address + "<br /><strong>Phone:</strong> " + d.phone + "<br /><strong>Membership Level:</strong> " + d.level + "<br /><strong>Number of Horses Registered:</strong> " + str(d.horses) + "<br /><strong>Total Registration Fee:</strong> $" + str(d.final_price))
#Jenn Registration
j = Registration()
j.name = "Jennifer"
j.address = "9012 Norland Avenue, Chambersburg, PA 17201"
j.phone = "555-573-9753"
j.level = "Youth"
j.horses = 5
j.fee = 25.95
j.calc_price()
#self.response.write ("<br><br><strong>Name:</strong> " + j.name + "<br /><strong>Address:</strong> " + j.address + "<br /><strong>Phone:</strong> " + j.phone + "<br /><strong>Membership Level:</strong> " + j.level + "<br /><strong>Number of Horses Registered:</strong> " + str(j.horses) + "<br /><strong>Total Registration Fee:</strong> $" + str(j.final_price))
#Tara's Registration
t = Registration()
t.name = "Tara"
t.address = "1242 Livermoore Road, Chambersburg, PA 17201"
t.phone = "555-234-9874"
t.level = "Professional"
t.horses = 15
t.fee = 125.95
t.calc_price()
#self.response.write ("<br><br><strong>Name:</strong> " + t.name + "<br /><strong>Address:</strong> " + t.address + "<br /><strong>Phone:</strong> " + t.phone + "<br /><strong>Membership Level:</strong> " + t.level + "<br /><strong>Number of Horses Registered:</strong> " + str(t.horses) + "<br /><strong>Total Registration Fee:</strong> $" + str(t.final_price))
p = Page()
#p.body = "<strong>Name:</strong> " + c.name + "<br /><strong>Address:</strong> " + c.address + "<br /><strong>Phone:</strong> " + c.phone + "<br /><strong>Membership Level:</strong> " + c.level + "<br /><strong>Number of Horses Registered:</strong> " + str(c.horses) + "<br /><strong>Total Registration Fee:</strong> $" + str(c.final_price) + "<br/><hr><strong>Name:</strong> " + m.name + "<br /><strong>Address:</strong> " + m.address + "<br /><strong>Phone:</strong> " + m.phone + "<br /><strong>Membership Level:</strong> " + m.level + "<br /><strong>Number of Horses Registered:</strong> " + str(m.horses) + "<br /><strong>Total Registration Fee:</strong> $" + str(m.final_price) + "<br/><hr><strong>Name:</strong> " + d.name + "<br /><strong>Address:</strong> " + d.address + "<br /><strong>Phone:</strong> " + d.phone + "<br /><strong>Membership Level:</strong> " + m.level + "<br /><strong>Number of Horses Registered:</strong> " + str(d.horses) + "<br /><strong>Total Registration Fee:</strong> $" + str(d.final_price) + "<br/><hr><strong>Name:</strong> " + j.name + "<br /><strong>Address:</strong> " + j.address + "<br /><strong>Phone:</strong> " + j.phone + "<br /><strong>Membership Level:</strong> " + j.level + "<br /><strong>Number of Horses Registered:</strong> " + str(j.horses) + "<br /><strong>Total Registration Fee:</strong> $" + str(j.final_price) + "<br/><hr><strong>Name:</strong> " + t.name + "<br /><strong>Address:</strong> " + t.address + "<br /><strong>Phone:</strong> " + t.phone + "<br /><strong>Membership Level:</strong> " + t.level + "<br /><strong>Number of Horses Registered:</strong> " + str(t.horses) + "<br /><strong>Total Registration Fee:</strong> $" + str(t.final_price)
p.body = "<h1>Registered Members</h1><a href='?name="+ c.name +"'>" + c.name + "</a><br>" + "<a href='?name="+ m.name +"'>" + m.name + "</a><br>" + "<a href='?name="+ d.name +"'>" + d.name + "</a><br>" + "<a href='?name="+ j.name +"'>" + j.name + "</a><br>" + "<a href='?name="+ t.name +"'>" + t.name + "</a><br>"
# When link is click and there is variables this following is viewed
if self.request.GET:
name = self.request.GET['name']
# if variable = Charles
if name == "Charles":
address = c.address
phone = c.phone
level = c.level
horses = c.horses
fee = c.fee
_final_price = m.calc_price()
p.view = "<hr><h1>View Member Information:</h1><strong>Name:</strong> " + name + "<br/><strong>Address:</strong> " + address + "<br><strong>Phone:</strong> " + phone + "</br><strong>Address:</strong> " + level + "<br/><strong>Horses:</strong> " + str(horses) + "<br/><strong>Registration Fee:</strong> $" + str(fee) + "<br/><strong>Final Registration Price:</strong> $" + str(_final_price)
# if variable = Megan
if name == "Megan":
address = m.address
phone = m.phone
level = m.level
horses = m.horses
fee = m.fee
_final_price = m.calc_price()
p.view = "<hr><h1>View Member Information:</h1><strong>Name:</strong> " + name + "<br/><strong>Address:</strong> " + address + "<br><strong>Phone:</strong> " + phone + "</br><strong>Address:</strong> " + level + "<br/><strong>Horses:</strong> " + str(horses) + "<br/><strong>Registration Fee:</strong> $" + str(fee) + "<br/><strong>Final Registration Price:</strong> $" + str(_final_price)
# if variable = Duke
if name == "Duke":
address = d.address
phone = d.phone
level = d.level
horses = d.horses
fee = d.fee
_final_price = d.calc_price()
p.view = "<hr><h1>View Member Information:</h1><strong>Name:</strong> " + name + "<br/><strong>Address:</strong> " + address + "<br><strong>Phone:</strong> " + phone + "</br><strong>Address:</strong> " + level + "<br/><strong>Horses:</strong> " + str(horses) + "<br/><strong>Registration:</strong> $" + str(fee) + "<br/><strong>Final Registration Price:</strong> $" + str(_final_price)
# if variable = Jennifer
if name == "Jennifer":
address = j.address
phone = j.phone
level = j.level
horses = j.horses
fee = j.fee
_final_price = j.calc_price()
p.view = "<hr><h1>View Member Information:</h1><strong>Name:</strong> " + name + "<br/><strong>Address:</strong> " + address + "<br><strong>Phone:</strong> " + phone + "</br><strong>Address:</strong> " + level + "<br/><strong>Horses:</strong> " + str(horses) + "<br/><strong>Registration:</strong> $" + str(fee) + "<br/><strong>Final Registration Price:</strong> $" + str(_final_price)
# if variable = Tara
if name == "Tara":
address = t.address
phone = t.phone
level = t.level
horses = t.horses
fee = t.fee
_final_price = t.calc_price()
p.view = "<hr><h1>View Member Information:</h1><strong>Name:</strong> " + name + "<br/><strong>Address:</strong> " + address + "<br><strong>Phone:</strong> " + phone + "</br><strong>Address:</strong> " + level + "<br/><strong>Horses:</strong> " + str(horses) + "<br/><strong>Registration:</strong> $" + str(fee) + "<br/><strong>Final Registration Price:</strong> $" + str(_final_price)
else: # if no variables then nothing is viewed
p.view = ''
self.response.write(p.print_out())