コード例 #1
0
ファイル: utils.py プロジェクト: aether-space/spacepaste
def render_to_response(template_name, **context):
    """Render a template to a response. This automatically fetches
    the list of new replies for the layout template. It also
    adds the current request to the context. This is used for the
    welcome message.
    """
    from spacepaste.models import Paste
    request = local.request
    if request.method == 'GET':
        context['new_replies'] = Paste.fetch_replies()
    return Response(render_template(template_name, **context),
                    mimetype='text/html')