fastapi/fastapi
Sebastián Ramírez 38d8bab770
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>
2020-08-08 09:14:10 +02:00
..
dependencies Raise early when using form data without installing python-multipart (#1851) 2020-08-08 09:14:10 +02:00
middleware Re-export utils from Starlette (#1064) 2020-03-01 21:49:20 +01:00
openapi ♻ Simplify code syntax in several places (#1753) 2020-08-03 15:16:51 +02:00
security ♻ Simplify code syntax in several places (#1753) 2020-08-03 15:16:51 +02:00
__init__.py 🔖 Release version 0.60.1 2020-07-22 08:44:44 +02:00
applications.py ♻ Simplify code syntax in several places (#1753) 2020-08-03 15:16:51 +02:00
background.py Re-export utils from Starlette (#1064) 2020-03-01 21:49:20 +01:00
concurrency.py Re-export utils from Starlette (#1064) 2020-03-01 21:49:20 +01:00
datastructures.py Add support for UploadFile class annotations (#63) 2019-03-03 20:52:37 +04:00
encoders.py 🐛 Fix encoding a Pydantic model that inherits from another with json_encoders (#1769) 2020-08-03 17:24:29 +02:00
exception_handlers.py 🐛 Fix issue with exotic pydantic error serialization (#748) 2019-11-29 07:02:10 +01:00
exceptions.py 🎨 Add typing.Optional to variables that accept None as value (#1731) 2020-08-03 14:29:07 +02:00
logger.py 🔊 Refactor logging (#781) 2019-12-09 20:02:44 +01:00
param_functions.py 🎨 Add typing.Optional to variables that accept None as value (#1731) 2020-08-03 14:29:07 +02:00
params.py 🎨 Add typing.Optional to variables that accept None as value (#1731) 2020-08-03 14:29:07 +02:00
py.typed add py.typed to ship typing information (#209) 2019-05-11 13:43:47 +04:00
requests.py Re-export utils from Starlette (#1064) 2020-03-01 21:49:20 +01:00
responses.py Add ORJSONResponse (#1065) 2020-03-01 22:30:58 +01:00
routing.py 🎨 Add typing.Optional to variables that accept None as value (#1731) 2020-08-03 14:29:07 +02:00
staticfiles.py Re-export utils from Starlette (#1064) 2020-03-01 21:49:20 +01:00
templating.py Re-export utils from Starlette (#1064) 2020-03-01 21:49:20 +01:00
testclient.py Re-export utils from Starlette (#1064) 2020-03-01 21:49:20 +01:00
utils.py 🎨 Add typing.Optional to variables that accept None as value (#1731) 2020-08-03 14:29:07 +02:00
websockets.py Re-export utils from Starlette (#1064) 2020-03-01 21:49:20 +01:00