def pageview(self, cur_p=''): ''' View the list of the Log. ''' if cur_p == '': current_page_number = 1 else: current_page_number = int(cur_p) current_page_number = 1 if current_page_number < 1 else current_page_number pager_num = int(MLog.total_number() / CMS_CFG['list_num']) kwd = { 'pager': '', 'title': '', 'current_page': current_page_number, } arr_num = [] postinfo = MLog.query_all_current_url() for i in postinfo: postnum = MLog.count_of_current_url(i.current_url) arr_num.append(postnum) self.render('misc/log/pageview.html', kwd=kwd, infos=MLog.query_all_pageview( current_page_num=current_page_number), postinfo=postinfo, arr_num=arr_num, format_date=tools.format_date, userinfo=self.userinfo)
def test_count_of_current_url(self): p = {'url': 'http://10101010101'} self.add_message(**p) a = MLog.count_of_current_url(p['url']) assert a >= 1 self.tearDown()
def test_count_of_current_url(self): MLog.count_of_current_url('') assert True