コード例 #1
0
ファイル: test_collect.py プロジェクト: Silentsoul04/TorCMS
 def add_mess(self):
     self.add_message()
     MCollect.add_or_update(self.user_id, self.post_id)
     a = MCollect.query_pager_by_all(self.user_id)
     tf = False
     for i in a:
         if i.post_id == self.post_id:
             tf = True
     assert tf
コード例 #2
0
ファイル: test_collect.py プロジェクト: Silentsoul04/TorCMS
 def test_query_pager_by_all(self):
     user_id = self.user_id
     self.add_mess()
     a = MCollect.query_pager_by_all(user_id)
     tf = False
     for i in a:
         if i.post_id == self.post_id:
             tf = True
     assert tf
     self.tearDown()
コード例 #3
0
    def list(self, list, cur_p=''):
        if cur_p == '':
            current_page_num = 1
        else:
            current_page_num = int(cur_p)

        current_page_num = 1 if current_page_num < 1 else current_page_num

        num_of_cat = MCollect.count_of_user(self.userinfo.uid)
        page_num = int(num_of_cat / CMS_CFG['list_num']) + 1

        kwd = {'current_page': current_page_num}

        self.render('misc/collect/list.html',
                    recs_collect=MCollect.query_pager_by_all(
                        self.userinfo.uid, current_page_num).naive(),
                    pager=tools.gen_pager_purecss('/collect/{0}'.format(list),
                                                  page_num, current_page_num),
                    userinfo=self.userinfo,
                    cfg=CMS_CFG,
                    kwd=kwd)
コード例 #4
0
    def show_list(self, the_list, cur_p=''):
        '''
        List of the user collections.
        '''

        current_page_num = int(cur_p) if cur_p else 1
        current_page_num = 1 if current_page_num < 1 else current_page_num

        num_of_cat = MCollect.count_of_user(self.userinfo.uid)
        page_num = int(num_of_cat / CMS_CFG['list_num']) + 1

        kwd = {'current_page': current_page_num}

        self.render('misc/collect/list.html',
                    recs_collect=MCollect.query_pager_by_all(
                        self.userinfo.uid, current_page_num).objects(),
                    pager=tools.gen_pager_purecss(
                        '/collect/{0}'.format(the_list), page_num,
                        current_page_num),
                    userinfo=self.userinfo,
                    cfg=CMS_CFG,
                    kwd=kwd)
コード例 #5
0
 def test_query_pager_by_all(self):
     user_id = self.user_id
     MCollect.query_pager_by_all(user_id)
     assert True