当前位置: 首页>>代码示例>>Python>>正文


Python Page.page_result方法代码示例

本文整理汇总了Python中pages.Page.page_result方法的典型用法代码示例。如果您正苦于以下问题:Python Page.page_result方法的具体用法?Python Page.page_result怎么用?Python Page.page_result使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pages.Page的用法示例。


在下文中一共展示了Page.page_result方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

# 需要导入模块: from pages import Page [as 别名]
# 或者: from pages.Page import page_result [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())
开发者ID:sgehrke,项目名称:Gehrke_Shaun_DPW,代码行数:88,代码来源:main.py


注:本文中的pages.Page.page_result方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。