Esempio n. 1
0
 def get(self):
     # 分页
     pager = Pager(self)
     article_search_params = ArticleSearchParams(self)
     article_search_params.show_article_type = True
     article_search_params.show_source = True
     article_search_params.show_summary = True
     article_search_params.show_comments_count = True
     future = self.async_do(ArticleService.page_articles, self.db, pager,
                            article_search_params)
     # future.result() 会阻塞调用
     pager = future.result()
     # self.render("base.html", base_url=self.reverse_url('index'), pager=pager, article_search_params=article_search_params)
     self.render("index.html",
                 base_url=self.reverse_url('index'),
                 pager=pager,
                 article_search_params=article_search_params)
Esempio n. 2
0
    def get(self):
        pager = Pager(self)
        article_search_params = ArticleSearchParams(self)

        article_search_params.show_article_type = True
        article_search_params.show_source = True
        article_search_params.show_summary = True
        article_search_params.show_comments_count = True
        # logging.info('jjj')
        # logging.info(article_search_params )# 起码不是空的字典, 至少是个object 对象
        pager = yield self.async_do(ArticleService.page_articles, self.db,
                                    pager, article_search_params)
        logging.info(pager)
        # {'totalCount': 0L, 'totalPage': 1, 'pageSize': 10, 'pageNo': 1, 'result': []}
        self.render("index.html",
                    base_url=self.reverse_url('index'),
                    pager=pager,
                    article_search_params=article_search_params)