예제 #1
0
    def get(self, topic_id=None, comment_content_error=None, comment_content=''):
        if not topic_id:
            self.about(404)
        
        topic = fetch_cached_board_topic(topic_id)
        topic_more_content = fetch_cached_board_topic_morecontent(topic_id)
        if not topic:
            self.about(404)
        node = topic.node
    
        topic_has_voted = False
        people_id = None
        people = None
        page = self.get_argument("page", "1")
        page = string2int(page)
        if page < 1:
            page = 1
    
        if people_id:
            topic_has_voted = topic.has_voted(people_id)
        limit = PageMaxLimit
        offset = (page-1) * PageMaxLimit
        comments = topic.get_comments(limit=limit, offset=offset)
        total_pages = topic.comment_count/limit
        last_page = topic.comment_count  % limit
        if last_page > 0:
            total_pages += 1
     

    
        node_list = fetch_cached_board_nodelist()
        to = timeout(topic.create_time)
        topic_can_edit = False
        #if people and to < 600 and topic.is_author(people):
        #    topic_can_edit = True
        
        pagination = Pagination(page, total_pages)
        #return self.write(topic_more_content)
        self.render("board/topic.html", timeover=timeover,  topic=topic, topic_more_content=topic_more_content, node=node, node_list=node_list,
                   xsrf_token=self.xsrf_token, pagination=pagination, comment_list=comments, topic_has_voted=topic_has_voted, topic_can_edit=topic_can_edit,
                   comment_content_error=comment_content_error, comment_content=comment_content)
예제 #2
0
 def get(self):
     topic_id = self.get_argument('topic_id', None)
     if not topic_id:
         return self.render_json(dict(html=''))
     html = fetch_cached_board_topic_morecontent(topic_id)
     return self.render_json(dict(html=html))