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

Add support for PathLike objects in static file helpers #3059

Merged
merged 1 commit into from Jan 5, 2019

Conversation

@mattrobenolt
Copy link
Contributor

commented Jan 4, 2019

See: https://www.python.org/dev/peps/pep-0519/

This is mostly encountered with pathlib in python 3, but this API
suggests any PathLike object can be treated like a filepath with
__fspath__ function.

flask/helpers.py Outdated Show resolved Hide resolved
flask/helpers.py Show resolved Hide resolved
@mattrobenolt

This comment has been minimized.

Copy link
Contributor Author

commented Jan 4, 2019

Also seems that master is broken since the tests failing are unrelated to my changes here afaict.

@mitsuhiko

This comment has been minimized.

Copy link
Member

commented Jan 4, 2019

This seems fine. I need to check what's up with master.

@davidism

This comment has been minimized.

Copy link
Member

commented Jan 4, 2019

I need to fix a test after an improvement to Werkzeug, don't worry about it.

@mattrobenolt mattrobenolt force-pushed the mattrobenolt:fspath branch from 4d8510c to 0312111 Jan 4, 2019

@mattrobenolt

This comment has been minimized.

Copy link
Contributor Author

commented Jan 4, 2019

@davidism updated the versionadded tag.

flask/_compat.py Outdated Show resolved Hide resolved

@mattrobenolt mattrobenolt force-pushed the mattrobenolt:fspath branch from 0312111 to 9b92f9b Jan 4, 2019

@davidism

This comment has been minimized.

Copy link
Member

commented Jan 4, 2019

Thanks, I'll rebase and merge this once I get the test fixed.

@davidism davidism force-pushed the mattrobenolt:fspath branch from 9b92f9b to 0078407 Jan 5, 2019

Add support for PathLike objects in static file helpers
See: https://www.python.org/dev/peps/pep-0519/

This is mostly encountered with pathlib in python 3, but this API
suggests any PathLike object can be treated like a filepath with
`__fspath__` function.

@davidism davidism force-pushed the mattrobenolt:fspath branch from 0078407 to 25de45c Jan 5, 2019

@davidism davidism merged commit 4d37aca into pallets:master Jan 5, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@davidism

This comment has been minimized.

Copy link
Member

commented Jan 5, 2019

Thanks for working on this! If you're interested, I think the underlying path functions from Werkzeug should probably support this as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.