-
-
Notifications
You must be signed in to change notification settings - Fork 950
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into disable_serialize_to_xml
- Loading branch information
Showing
30 changed files
with
599 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
The new implementation of :ref:`media type utilities <mediatype_util>` | ||
(Falcon was using the ``python-mimeparse`` library before) now always favors | ||
the exact media type match, if one is available. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Falcon is no longer vendoring the | ||
`python-mimeparse <https://github.com/falconry/python-mimeparse>`__ library; | ||
the relevant functionality has instead been reimplemented in the framework | ||
itself, fixing a handful of long-standing bugs in the new implementation. | ||
|
||
If you use standalone | ||
`python-mimeparse <https://github.com/falconry/python-mimeparse>`__ in your | ||
project, do not worry! We will continue to maintain it as a separate package | ||
under the Falconry umbrella (we took over about 3 years ago). | ||
|
||
The following new behaviors are considered breaking changes: | ||
|
||
* Previously, the iterable passed to | ||
:meth:`req.client_prefers <falcon.Request.client_prefers>` had to be sorted in | ||
the order of increasing desirability. | ||
:func:`~falcon.mediatypes.best_match`, and by proxy | ||
:meth:`~falcon.Request.client_prefers`, now consider the provided media types | ||
to be sorted in the (more intuitive, we hope) order of decreasing | ||
desirability. | ||
|
||
* Unlike ``python-mimeparse``, the new | ||
:ref:`media type utilities <mediatype_util>` consider media types with | ||
different values for the same parameters as non-matching. | ||
|
||
One theoretically possible scenario where this change can affect you is only | ||
installing a :ref:`media <media>` handler for a content type with parameters; | ||
it then may not match media types with conflicting values (that used to match | ||
before Falcon 4.0). | ||
If this turns out to be the case, also | ||
:ref:`install the same handler <custom_media_handlers>` for the generic | ||
``type/subtype`` without parameters. | ||
|
||
The new functions, | ||
:func:`falcon.mediatypes.quality` and :func:`falcon.mediatypes.best_match`, | ||
otherwise have the same signature as the corresponding methods from | ||
``python-mimeparse``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import falcon | ||
|
||
|
||
class QuoteResource: | ||
def on_get(self, req: falcon.Request, resp: falcon.Response) -> None: | ||
"""Handle GET requests.""" | ||
resp.media = { | ||
'quote': "I've always been more interested in the future than in the past.", | ||
'author': 'Grace Hopper', | ||
} | ||
|
||
|
||
app = falcon.App() | ||
app.add_route('/quote', QuoteResource()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.