Beispiel #1
0
def index():
    """Display front page with recent blog posts and Github commits"""
    context = {
        'posts': query_posterous.get_posts(),
        'commits': query_github.get_commits(),
        'title': "Home",
    }
    return render_template('index.html', **context)
Beispiel #2
0
def apps(app_name, page=1):
    context = {
        'title': title_lookup[app_name],
        'commits': query_github.get_commits()
    }
    total_pages = page_counts[app_name]
    if page > total_pages:
        abort(404)
    if total_pages == 1:
        template_name = 'content/%s.markdown' % app_name
    else:
        pages = range(1, int(total_pages)+1)
        this_page=int(page)
        if this_page > 1:
            context['previous_page'] = url_for('apps', app_name=app_name, page=this_page-1)
        if this_page < total_pages:
            context['next_page'] = url_for('apps', app_name=app_name, page=this_page+1)
        template_name = 'content/%s_%s.markdown' % (app_name, page)
    
    with encodings.codecs.open(template_name, 'r', encoding='utf-8') as f:
        context['html'] = Markup(markdown.markdown(f.read()))
    return render_template('page.html', **context)