]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commit
✨ Raise early when using form data without installing python-multipart (#1851)
authorSebastián Ramírez <tiangolo@gmail.com>
Sat, 8 Aug 2020 07:14:10 +0000 (09:14 +0200)
committerGitHub <noreply@github.com>
Sat, 8 Aug 2020 07:14:10 +0000 (09:14 +0200)
commit38d8bab770480ec34231b2412eba040f058f7198
tree977a1b6758d48f2b5578c3cb970503793bdec05b
parent52f0f8657e93c5ad72568e7b71dafb8c4fc9f9d6
✨ Raise early when using form data without installing python-multipart (#1851)

* Check if Form exists and multipart is in virtual environment

* Remove unused import

* Move BodyFieldInfo check to separate helper function

* Fix type UploadFile to File for BodyFieldInfo check

* Working solution. Kind of nasty though.

* Use better method of determing if correct package imported

* Use better method of determing if correct package imported

* Add raising exceptions, update error messages

* Check if Form exists and multipart is in virtual environment

* Move BodyFieldInfo check to separate helper function

* Fix type UploadFile to File for BodyFieldInfo check

* Use better method of determing if correct package imported

* Add raising exceptions, update error messages
* Removed unused import, added comments

Co-authored-by: Christopher Nguyen <chrisngyn99@gmail.com>
* Updated what kind of exception will be thrown

* Add type annotations

Adds annotations to is_form_data

* Fix import order

* Add basic tests

* Fixed Travis tests

* Replace logging with fastapi logger

* Change AttributeError to ImportError to fix exception handling

* Fixing tests

* Catch ModuleNotFoundError first

Fix code coverage

* Update fastapi/dependencies/utils.py

Remove error spaces when printing

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
* Update fastapi/dependencies/utils.py

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
* Removed spaces in error printing

* ♻️ Refactor form data detection

* ✅ Update/increase tests for incorrect multipart install

* 🔥 Remove deprecated Travis (moved to GitHub Actions)

Co-authored-by: yk396 <yk396@cornell.edu>
Co-authored-by: Christopher Nguyen <chrisngyn99@gmail.com>
Co-authored-by: Kai Chen <kaichen120@gmail.com>
Co-authored-by: Chris N <hello@chris-nguyen.me>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
fastapi/dependencies/utils.py
tests/test_multipart_installation.py [new file with mode: 0644]