Beispiel #1
0
    def GET(self):
        urltype_str = web.ctx.path
        urltypes = urltype_str.split("/")[2:]
        typeL1 = urltypes[0]
        typeL2 = (len(urltypes) > 1) and urltypes[1] or None

        # hack手段,因为 这一分类下有反斜杠
        if typeL2 == "IOS (iPad":
            typeL2 = "IOS (iPad/iPhone)"

        # 如果url中有'_'符号,替换为空格
        typeL1 = typeL1.replace("_", " ")
        if typeL2:
            typeL2 = typeL2.replace("_", " ")

        # 处理分页
        params = web.input()
        curr_page = params.page if hasattr(params, "page") else 1
        offset = (int(curr_page) - 1) * perpage

        results, count = mirrordb.get_top_records(typeL1, typeL2, offset)
        # 计算一共有多少页
        pages = count / perpage
        # 上一页/下一页
        lastpage = int(curr_page) - 1
        nextpage = int(curr_page) + 1

        page_list = []
        total = pages
        for p in range(0, 10):
            page_list.append(p + int(curr_page))

        return render.view(results, page_list, total, lastpage, nextpage, typeL1, typeL2)
Beispiel #2
0
    def GET(self):
        urltype_str = web.ctx.path
        urltypes = urltype_str.split('/')[2:]
        typeL1 = urltypes[0]
        typeL2 = (len(urltypes) > 1) and urltypes[1] or None

        #hack手段,因为 这一分类下有反斜杠
        if (typeL2 == "IOS (iPad"):
            typeL2 = "IOS (iPad/iPhone)"

        #如果url中有'_'符号,替换为空格
        typeL1 = typeL1.replace('_', ' ')
        if typeL2:
            typeL2 = typeL2.replace('_', ' ')

        #处理分页
        params = web.input()
        curr_page = params.page if hasattr(params, 'page') else 1
        offset = (int(curr_page) - 1) * perpage

        results, count = mirrordb.get_top_records(typeL1, typeL2, offset)
        #计算一共有多少页
        pages = count / perpage
        #上一页/下一页
        lastpage = int(curr_page) - 1
        nextpage = int(curr_page) + 1

        page_list = []
        total = pages
        for p in range(0, 10):
            page_list.append(p + int(curr_page))

        return render.view(results, page_list, total, lastpage, nextpage,
                           typeL1, typeL2)
Beispiel #3
0
 def GET(self):
     try:
         resource_info_id_str = web.ctx.path
         resource_info_id = int(resource_info_id_str.split("/")[2])
         results = mirrordb.get_resource_group(resource_info_id)
         return render.view(results, [], 0, 0, 0)
     except:
         return render.error("没有找到您要的信息,我们会尽快录入", "/")
Beispiel #4
0
 def GET(self):
     try:
         resource_info_id_str = web.ctx.path
         resource_info_id = int(resource_info_id_str.split('/')[2])
         results = mirrordb.get_resource_group(resource_info_id)
         return render.view(results, [], 0, 0, 0)
     except:
         return render.error("没有找到您要的信息,我们会尽快录入", "/")
Beispiel #5
0
    def GET(self):
        # 处理分页
        params = web.input()
        curr_page = params.page if hasattr(params, "page") else 1
        offset = (int(curr_page) - 1) * perpage

        results = mirrordb.get_recent_records(offset)
        # 计算一共有多少页
        pages = recent_count_limit / perpage
        # 上一页/下一页
        lastpage = int(curr_page) - 1
        nextpage = int(curr_page) + 1

        page_list = []
        total = pages
        for p in range(0, 10):
            page_list.append(p + int(curr_page))

        return render.view(results, page_list, total, lastpage, nextpage)
Beispiel #6
0
    def GET(self):
        #处理分页
        params = web.input()
        curr_page = params.page if hasattr(params, 'page') else 1
        offset = (int(curr_page) - 1) * perpage

        results = mirrordb.get_recent_records(offset)
        #计算一共有多少页
        pages = recent_count_limit / perpage
        #上一页/下一页
        lastpage = int(curr_page) - 1
        nextpage = int(curr_page) + 1

        page_list = []
        total = pages
        for p in range(0, 10):
            page_list.append(p + int(curr_page))

        return render.view(results, page_list, total, lastpage, nextpage)
Beispiel #7
0
 def GET(self):
     search_type = web.input().searchtype
     search_name = web.input().wd
     results = mirrordb.search_all_resource(resource_type=search_type, name=search_name)
     return render.view(results, [], 0, 0, 0)
Beispiel #8
0
 def GET(self):
     results = mirrordb.get_top_records()
     return render.view(results, [], 0, 0, 0)
Beispiel #9
0
 def GET(self):
     search_type = web.input().searchtype
     search_name = web.input().wd
     results = mirrordb.search_all_resource(resource_type=search_type,
                                            name=search_name)
     return render.view(results, [], 0, 0, 0)
Beispiel #10
0
 def GET(self):
     results = mirrordb.get_top_records()
     return render.view(results, [], 0, 0, 0)