def render(self, *args): ysearch = YunSearch() tag_slug = args[0] current = int(args[1]) res_all = ysearch.get_all_num(tag_slug) page_num = int(res_all / config.CMS_CFG['list_num']) kwd = { 'page_home': False if current <= 1 else True, 'page_end': False if current >= page_num else True, 'page_pre': False if current <= 1 else True, 'page_next': False if current >= page_num else True, } return self.render_string('modules/post/search_pager.html', kwd=kwd, cat_slug=tag_slug, pager_num=page_num, page_current=current)
def render(self, *args, **kwargs): ysearch = YunSearch() catid = args[0] tag_slug = args[1] current = int(args[2]) res_all = ysearch.get_all_num(tag_slug, catid=catid) pager_count = int(res_all / config.CMS_CFG['list_num']) page_num = (pager_count if abs(pager_count - res_all / config.CMS_CFG['list_num']) < 0.1 else pager_count + 1) kwd = { 'page_home': False if current <= 1 else True, 'page_end': False if current >= page_num else True, 'page_pre': False if current <= 1 else True, 'page_next': False if current >= page_num else True, } return self.render_string('modules/post/search_pager.html', kwd=kwd, cat_slug=tag_slug, pager_num=page_num, page_current=current)
def initialize(self, **kwargs): super(SearchHandler, self).initialize() self.ysearch = YunSearch()
def initialize(self, **kwargs): super().initialize() self.ysearch = YunSearch()