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())
评论列表
文章目录