def page_get(self): pager = Pager(self) article_search_params = ArticleSearchParams(self) article_types = yield self.async_do(ArticleTypeService.list_simple, self.db) pager = yield self.async_do(ArticleService.page_articles, self.db, pager, article_search_params) self.render("admin/manage_articles.html", article_types=article_types, pager=pager, article_search_params=article_search_params)
def page_get(self): pager = Pager(self) article_search_params = ArticleSearchParams(self) # article_types = await IOLoop.current().run_in_executor(self.thread_executor, ArticleTypeService.list_simple, self.db) future1 = self.async_do(ArticleTypeService.list_simple, self.db) article_types = future1.result() future2 = self.async_do(ArticleService.page_articles, self.db, pager, article_search_params) pager = future2.result() self.render("admin/manage_articles.html", article_types=article_types, pager=pager, article_search_params=article_search_params)
def get(self, source_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.source_id = source_id pager = yield self.async_do(ArticleService.page_articles, self.db, pager, article_search_params) self.render("index.html", base_url=self.reverse_url('articleSource', source_id), pager=pager, article_search_params=article_search_params)
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)
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)
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)