本文整理匯總了Python中pages.Page.interest方法的典型用法代碼示例。如果您正苦於以下問題:Python Page.interest方法的具體用法?Python Page.interest怎麽用?Python Page.interest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pages.Page
的用法示例。
在下文中一共展示了Page.interest方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get
# 需要導入模塊: from pages import Page [as 別名]
# 或者: from pages.Page import interest [as 別名]
def get(self):
#create a shortcut to the Page() class
p = Page()
#if the GET method is invoked, grab the form values and set them to the proper keys
if self.request.GET:
#create a shortcut for self.request
sr = self.request
#set the page title.
p.title = "Eric Rogers | Thank You!"
#set the Page().name attribute to the input value submitted.
p.name = sr.GET['name']
#set the Page().telephone attribute to the input value submitted.
p.telephone = sr.GET['telephone']
#set the Page().email attribute to the input value submitted.
p.email = sr.GET['email']
#set the Page().interest attribute to the input value submitted.
p.interest = sr.GET['interest']
#set the Page().return_customer attribute to reflect the user's choice when checked.
p.return_customer = 'Yes, please give me a 10% discount.'
#try to grab the Page().return_customer checkbox value
try:
sr.GET['return_customer']
#if there is no value, the server throws a KeyError meaning the box is not checked.
except KeyError:
#set the Page().return_customer attribute to reflect the user's choice when not checked.
p.return_customer = 'No, I am a new customer.'
#output Page().view2 to the page.
self.response.write(p.view2())
#otherwise, output Page().view1 to the page.
else:
self.response.write(p.view1())