views.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:mos-horizon 作者: Mirantis 项目源码 文件源码
def _download_rc_file_for_template(request, context, template):
    try:
        response = shortcuts.render(request,
                                    template,
                                    context,
                                    content_type="text/plain")
        response['Content-Disposition'] = ('attachment; '
                                           'filename="%s-openrc.sh"'
                                           % context['tenant_name'])
        response['Content-Length'] = str(len(response.content))
        return response

    except Exception as e:
        LOG.exception("Exception in DownloadOpenRCForm.")
        messages.error(request, _('Error Downloading RC File: %s') % e)
        return shortcuts.redirect(request.build_absolute_uri())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号