Example #1
0
def get_cached_board_topic(topic_id):
    try:
        
        topic = BoardTopic.objects.with_id(topic_id)
        if topic is None:
            return None
        
        if topic.content:
            topic.html_content = urlink(escape(topic.content))  #urlink((mentions(youku(escape(topic.content)) ) ) , trim_url_limit=30)
        else:
            topic.html_content = ''
        if topic.more_content:
            topic.html_more_content = br_escape(urlink(escape(topic.more_content)))  #urlink((mentions(youku(escape(topic.content)) ) ) , trim_url_limit=30)
        else:
            topic.html_more_content = ''
        if topic.video_urls:
            topic.extra_content = ''
            video_html = '<p></p>'
            for url in topic.video_urls:
                video_html += video(url)
            topic.extra_content = video_html
        
        return topic
    except Exception, error:
        return None
Example #2
0
def get_cached_board_topic_morecontent(topic_id):
    try:
        topic = fetch_cached_board_topic(topic_id)
        if topic is None:
            return None
        html_more_content = ''
        if topic.more_content:
            html_more_content = br_escape(urlink(escape(topic.more_content)))  #urlink((mentions(youku(escape(topic.content)) ) ) , trim_url_limit=30)
        extra_content = ''
        if topic.video_urls:
            
            video_html = '<p></p>'
            for url in topic.video_urls:
                video_html += video(url)
            extra_content = video_html
        return html_more_content + extra_content
    except Exception, error:
        return None