예제 #1
0
파일: home.py 프로젝트: wjkaola123/blog
 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
     pager = yield self.async_do(ArticleService.page_articles, self.db, pager, article_search_params)
     self.render("index.html", base_url=self.reverse_url('index'),
                 pager=pager, article_search_params=article_search_params)
예제 #2
0
 async def get(self, type_id):
     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
     article_search_params.articleType_id = type_id
     pager = await self.loop_current.run_in_executor(
         self.thread_executor, ArticleService.page_articles, self.db, pager,
         article_search_params)
     self.render("index.html",
                 base_url=self.reverse_url('articleType', type_id),
                 pager=pager,
                 article_search_params=article_search_params)
예제 #3
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)
예제 #4
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)