本文整理汇总了Python中pages.Page.get_name方法的典型用法代码示例。如果您正苦于以下问题:Python Page.get_name方法的具体用法?Python Page.get_name怎么用?Python Page.get_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pages.Page
的用法示例。
在下文中一共展示了Page.get_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from pages import Page [as 别名]
# 或者: from pages.Page import get_name [as 别名]
def get(self):
p = Page() # p instantiates the class Page
c = Course() # c does the same for the class Course
# Object for Pebble Beach
pebble = Course()
pebble.name = "Pebble Beach"
pebble.yardage = 6828
pebble.course_rating = 75.5 # this attribute is set to private in the contructor but with the getter-setter I am able to set the variable
pebble.par = 72
pebble.slope = 145
pebble.calc_rating()
pebble.bogey_rating = pebble.bogey_rating
# Object for Bethpage Black
bethpage = Course()
bethpage.name = "Bethpage Black"
bethpage.yardage = 7386
bethpage.course_rating = 78.1
bethpage.par = 72
bethpage.slope = 152
bethpage.calc_rating()
print bethpage.bogey_rating
# Object for TPC Sawgrass
sawgrass = Course()
sawgrass.name = "TPC Sawgrass"
sawgrass.yardage = 7215
sawgrass.course_rating = 76.8
sawgrass.par = 72
sawgrass.slope = 155
sawgrass.calc_rating()
print sawgrass.bogey_rating
# Object for Shinecock Hills
shinnecock = Course()
shinnecock.name = "Shinnecock Hills"
shinnecock.yardage = 6781
shinnecock.course_rating = 74.7
shinnecock.par = 72
shinnecock.slope = 140
shinnecock.calc_rating()
print shinnecock.bogey_rating
# Object for Winged Foot
winged = Course()
winged.name = "Winged Foot"
winged.yardage = 7258
winged.course_rating = 76.1
winged.par = 72
winged.slope = 145
winged.calc_rating()
print winged.bogey_rating
# Object for Whistling Straits
straits = Course()
straits.name = "Whistling Straits"
straits.yardage = 7362
straits.course_rating = 77.2
straits.par = 72
straits.slope = 152
straits.calc_rating()
print straits.bogey_rating
p.head = '''
<!doctype html>
<body>
'''
print c.name[0]
# This is a really neat way to dynamically acess and use the objects
if self.request.GET:
p.get_name = self.request.GET['name'] # uses the to dynamically fill the image tag
course = self.request.GET['name'] # gets the click info
c = locals()[course] # refers c to the object course
p.course = c # lets pages.py have access to c
#both of the next lines print depending on conditional result
print "line 88"
print c
self.response.write(p.page_result())
else:
self.response.write(p.print_page())