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_query_all_current_url(self): self.tearDown() self.add_message() a = MLog.query_all_current_url() tf = False for i in a: if i.uid == self.uid: tf = True assert tf self.tearDown()
def test_query_all(self): p = {'user_id': 'None'} self.add_message(**p) a = MLog.query_all_current_url() x = int(a.count() / 10) tf = False for y in range(x + 3): a = MLog.query_all(current_page_num=y) for i in a: if i.uid == self.uid: tf = True break assert tf self.tearDown()
def test_query_all_pageview(self): self.tearDown() self.add_message() a = MLog.query_all_current_url() x = int(a.count() / 10) tf = False for y in range(x + 3): a = MLog.query_all_pageview(current_page_num=y) for i in a: if i.uid == self.uid: tf = True break assert tf self.tearDown()
def test_query_all_current_url(self): MLog.query_all_current_url() assert True