-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix prefix_jobid issue #128
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
I'm going to try and fix this, but I want to lay out some architectural information so that others may hopefully feel less confused by the layout of code. If this is helpful, we can drop this info into developer docs or
(Submitting this comment now so I don't lose my work. I may edit later.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please merge in |
Confirming that this fix gives me the desired behavior and appoving. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Add as_attachment and download_name to get_file() * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add optional download_name to get_file requests * [pre-commit.ci] auto fixes from pre-commit.com hooks * Remove comment. * Use kwarg. * Update changelog Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Corwin Kerr <cbkerr@umich.edu> Co-authored-by: Bradley Dice <bdice@bradleydice.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #128 +/- ##
==========================================
- Coverage 63.30% 63.21% -0.10%
==========================================
Files 18 18
Lines 665 666 +1
==========================================
Hits 421 421
- Misses 244 245 +1 ☔ View full report in Codecov by Sentry. |
Description
See #127. After a lot of testing, I have found that the only way to get the desired behavior for the default download name is to add
as_attachement
anddownload_name
to where we callflask.send_from_directory()
inviews.get_file()
. This initial change is obviously a bad solution: I'm hard-coding the filename. Some observed behavior:as_attachment=True
and do not send anything indownload_name
, I still do not get the correct default download file name in my Save As dialog box. The only thing this seems to change is theContent-Disposition
response header, which changes frominline; filename=filename.txt
whenas_attachment=False
toattachment; filename=energy-plot-timesteps.txt
whenas_attachment=True
as_attachment=True
and set an undefined variable asdownload_name
(e.g.,download_name=x
), the correct filename shows up on the download box, but aTypeError
is thrown and the download errors outas_attachment=True
and pass any string intodownload_name
, the dowloaded file's name is that string by defaultMotivation and Context
Resolves #127
I do not know how to proceed. I cannot figure out how to get the correct download name into that function. Any pointers would be greatly appreciated.
Checklist: