Exemplo n.º 1
0
 def ajax_list_catalog(self, catid):
     '''
     Get posts of certain catid. In Json.
     '''
     out_arr = {}
     for catinfo in MPost2Catalog.query_postinfo_by_cat(catid):
         out_arr[catinfo.uid] = catinfo.title
     json.dump(out_arr, self)
Exemplo n.º 2
0
    def delete_by_id(self, del_id):
        '''
        Delete  by id.

        '''
        print("-" * 50)
        print(del_id)
        if self.check_post_role()['DELETE']:
            pass
        else:
            return False
        post_resc = MPost2Catalog.query_postinfo_by_cat(del_id)
        for post in post_resc:
            MPost2Catalog.remove_relation(post.uid, del_id)
        if MCategory.delete(del_id):
            output = {'del_link': 1}
        else:
            output = {'del_link': 0}
        return json.dump(output, self)
Exemplo n.º 3
0
 def test_query_postinfo_by_cat(self):
     self.add_message()
     self.add_P2C()
     ss = MPost2Catalog.query_postinfo_by_cat(self.tag_id)
     assert ss[0].logo == 'prprprprpr'
     self.tearDown()
Exemplo n.º 4
0
 def test_query_postinfo_by_cat(self):
     MPost2Catalog.query_postinfo_by_cat(self.tag_id)
     assert True