Commit graph

42 commits

Author SHA1 Message Date
Dave Shawley
1fe22df719
Gracefully handle transcoder encoding failures.
Since the form encoder refuses to handle nested sequences, the content
mixin explicitly handles this case instead of letting the unhandled
exception bubble up.
2021-10-14 07:12:08 -04:00
Dave Shawley
716bff0d7f
Add application/x-www-formurlencoded transcoder.
I ended up not using urllib.parse functions since they do not implement
the specification.  The only difference is that the specification
requires that "~" is encoded.

NB - this commit is incomplete since it does not handle calling the
transcoder on simple objects.  mypy will quite correctly fail.
2021-10-14 07:12:01 -04:00
Dave Shawley
9ff5ca3781
Fail gracefully when transcoder is missing.
If there is no transcoder for the default content type, sending a
response would fail with a "500 Internal Server Error" due to an
*unhandled* KeyError.  This commit catches the KeyError and produces
an explicit "500 Internal Server Error" with an appropriate error
message being logged.
2021-10-03 15:52:48 -04:00
Dave Shawley
d605acb5b7
Deprecate not configuring a default content type. 2021-10-03 15:52:48 -04:00
Dave Shawley
4dd46eda5b
Return 406 Not Acceptable appropriately.
If there is no default content type and nothing matches in the Accept
header, previous versions would fail with an Internal Server Error
because of an unhandled exception.  Instead we should be returning
a "406 Not Acceptable".
2021-10-03 15:52:47 -04:00
Dave Shawley
4a0ca5e390
Documentation updates for typing.
The changes to `api.rst` are particularly important since that is where
I describe the externally available type annotations.
2021-10-03 15:52:47 -04:00
Dave Shawley
9ab953ed23
Use extlinks for changelog. 2021-09-12 18:34:08 -04:00
Dave Shawley
f6f84bdd2c 3.0.4: Reject invalid Content-Type headers. 2020-11-02 09:21:08 -05:00
Dave Shawley
21c6cb73fe Invalid content-type --> 400 Bad Request.
ietfparse raises a `ValueError` from `parse_content_type` which was
uncaught and resulted in an internal server error.
2020-10-29 13:50:33 -04:00
Dave Shawley
5755792959 3.0.3: Preparing for Python 3.9. 2020-09-14 08:10:20 -04:00
Dave Shawley
3dadd00c64 Metadata bumps for 3.0.2. 2020-05-04 16:55:22 -04:00
Gavin M. Roy
cdd56e6e06 Forgot the link definition 2019-03-05 09:36:06 -05:00
Gavin M. Roy
7da331464b Support Tornado 6, remove setuptools_scm 2019-03-05 09:32:00 -05:00
Andrew Rabert
5079ed1b06 Fix typo 2018-12-04 23:52:54 -05:00
Andrew Rabert
1a300dea34 Rename to match package name 2018-12-04 23:24:06 -05:00
Andrew Rabert
875dc0beb5 Release version 3.0.0 2018-12-04 23:20:33 -05:00
Andrew Rabert
73f512a0b6 Fix typos 2018-12-04 22:56:51 -05:00
Andrew Rabert
afddbd3800 Fix doc date 2018-08-07 15:55:01 -04:00
Andrew Rabert
4f187f80c1 Release version 2.2.2 2018-08-07 15:52:59 -04:00
Dave Shawley
5b74e20542 Metadata updates for 2.2.1. 2018-04-12 07:13:42 -04:00
Dave Shawley
a7a4481490 Update changelog.
We forgot the changelog in https://github.com/sprockets/sprockets.mixins.media_type/pull/16
2017-06-08 13:24:10 -04:00
Dave Shawley
1d00459c2e Metadata bumps for 2.2.0. 2017-06-07 06:45:26 -04:00
Dave Shawley
263d23a37d Cleanup documentation.
- Remove automatic hyphenation of table headings.
- Widen the document a little.
- Remove some of the padding around code snippets.
- Adjust the sidebar title again...
- Fix history links in the changelog.
2016-04-05 07:49:13 -04:00
Dave Shawley
18e134b6f2 Deprecate ContentSettings.from_application. 2016-04-05 07:47:41 -04:00
Dave Shawley
68fe438894 content: Add install and get_settings functions. 2016-04-05 07:46:57 -04:00
Dave Shawley
3e9ad72d63 Metadata bumps for 2.1.0 2016-03-16 09:19:43 -04:00
Dave Shawley
a1cc214bbe ContentMixin: Set the Vary header.
This lets any transparent caches that our responses will vary based on
the Accept header.  Without this, caches will assume that a cached
response can be used even if the Accept header differs.
2016-03-13 09:34:32 -04:00
Dave Shawley
d571209e38 Remove _mark_deprecated wrapper. 2016-02-29 14:35:07 -05:00
Dave Shawley
baf643e3ef Metadata bumps for 2.0.0. 2016-02-24 14:47:39 -05:00
Dave Shawley
206e43ee7d ContentMixin: Raise 400 when body decode fails. 2016-02-22 09:58:58 -05:00
Dave Shawley
995c715405 Normalize registered content types.
MIME content type strings are normalized by lower-casing the content
type parameters and then sorting them.  Each parameter is preceded by a
space.
2016-01-31 12:11:11 -05:00
Dave Shawley
98e3719a8b MsgPackTranscoder: Add BinaryWrapper override. 2016-01-18 07:58:30 -05:00
Dave Shawley
7d2237745e Add s.m.mediatype.transcoders.MsgPackTranscoder. 2016-01-18 07:58:07 -05:00
Dave Shawley
ee8f645a51 Add sprockets.mixins.mediatype.transcoders.JSONTranscoder. 2016-01-16 09:56:38 -05:00
Dave Shawley
d7f1bb1e4e Add content.add_transcoder. 2016-01-16 09:56:38 -05:00
Dave Shawley
ce54332cab Repackage sprockets.mixins.mediatype into a package.
Distributing a raw python module into a namespace package seems to be
somewhat unreliable though I haven't proven it yet...  In any case,
installing a package inside of a namespace package behaves itself.
2016-01-10 11:36:46 -05:00
Dave Shawley
ee26168e25 history.rst: Correct ReST syntax. 2015-11-02 14:25:42 -05:00
Amber Heilman
1a60c4a0f3 bump to 1.0.4 2015-09-14 11:15:29 -04:00
Amber Heilman
6353f4f47f bump to 1.0.3 2015-09-10 11:33:39 -04:00
Dave Shawley
91f7ad972f Version bumps around the world 2015-09-09 18:02:06 -04:00
Amber Heilman
0a7bf6113f bump for initial relase 1.0.0 2015-09-09 16:14:39 -04:00
Dan Tracy
f73a5e07ce Initial commit 2015-06-09 09:28:29 -04:00