Skip to content
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

DownloadHandler should allow returning Path objects #976

Open
wch opened this issue Jan 6, 2024 · 0 comments
Open

DownloadHandler should allow returning Path objects #976

wch opened this issue Jan 6, 2024 · 0 comments
Milestone

Comments

@wch
Copy link
Collaborator

wch commented Jan 6, 2024

Currently, DownloadHandlers can accepts strings, but not Path objects, so they have to be used like this:

@render.download()
def download():
    path = Path(__file__).parent / "mtcars.csv"
    return str(path)

It would be more convenient if you could just return a Path object, like this:

@render.download()
def download():
    return Path(__file__).parent / "mtcars.csv"

Also, I believe that currently there's no checking that the returned path is absolute, but we should do that, because the current working dir may not be the same as the app directory

@wch wch added this to the v0.9.0 milestone Mar 5, 2024
@schloerke schloerke modified the milestones: v0.9.0, v0.9.1 May 8, 2024
@schloerke schloerke modified the milestones: v0.10.0, v0.11.0 May 21, 2024
@wch wch modified the milestones: v1.0.0, v1.1.0 Jul 17, 2024
@cpsievert cpsievert modified the milestones: v1.1.0, v1.2.0 Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants