yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #77834
[Bug 1823089] [NEW] modal js code can't handle file download
Public bug reported:
The modal js code doesn't know how to process and handle when the
response data is a file attachment. What it does is append the data from
the file to the modal_wrapper.
My reason for hitting this is that I have a form which asks for some
information, and then the handle function returns a file.
```
content = render_to_string(
template, context, request=request)
content = '\n'.join([line for line in content.split('\n')
if line.strip()])
response = http.HttpResponse(
content, content_type="text/plain")
filename = 'openstack_backup_codes.txt'
disposition = 'attachment; filename=%s' % filename
response['Content-Disposition'] = disposition.encode(
'utf-8')
response['Content-Length'] = str(len(response.content))
return response
```
** Affects: horizon
Importance: Undecided
Assignee: Adrian Turjak (adriant-y)
Status: In Progress
** Summary changed:
- modal js code breaks on file download
+ modal js code can't handle file download
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1823089
Title:
modal js code can't handle file download
Status in OpenStack Dashboard (Horizon):
In Progress
Bug description:
The modal js code doesn't know how to process and handle when the
response data is a file attachment. What it does is append the data
from the file to the modal_wrapper.
My reason for hitting this is that I have a form which asks for some
information, and then the handle function returns a file.
```
content = render_to_string(
template, context, request=request)
content = '\n'.join([line for line in content.split('\n')
if line.strip()])
response = http.HttpResponse(
content, content_type="text/plain")
filename = 'openstack_backup_codes.txt'
disposition = 'attachment; filename=%s' % filename
response['Content-Disposition'] = disposition.encode(
'utf-8')
response['Content-Length'] = str(len(response.content))
return response
```
To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1823089/+subscriptions
Follow ups