Пример #1
0
def default_page_template_data(request, map):
    plain_old_comments = map.page.comments.all()
    if request.args.get('linear') is not None:
        comment_mode = 'linear'
        comments = linear(plain_old_comments)
    else:
        comment_mode = 'threaded'
        comments = thread(plain_old_comments)

    return {
        'display_options': MakoDict(default_display_options()),
        'page_data':       MakoDict({
            'page':                 map.page,
            'page_path':            map.request_path
        }),
        'comment_data':    MakoDict({
            'comment_count':        len(plain_old_comments),
            'comments':             comments,
            'comment_submit_path':  map.request_path,
            'comment_mode':         comment_mode,
            'form':                 request.form,
        }, ['comments', 'form']),
        'tags_data':       MakoDict({
            'tags':                 map.page.tags
        }),
        'related_posts':   related_posts(map.page),
        'lynx': lynx_browser(request)
    }
Пример #2
0
def comment_tree(request, comment_id):
    template_data = default_comment_template_data(request, comment_id)
    template_data['reply'] = False

    # TODO: optimize comment selection
    comments = thread(template_data['page'].comments.all())
    template_data['comments'] = comments

    return display_page(template_data)