Support ietfparse 1.5.1

ietfparse 1.5.1 broke sprockets.mixins.media_type as it introduced the
splitting of content suffix from content subtype. This commit fixes
that.
This commit is contained in:
Andrew Rabert 2018-11-30 11:52:46 -05:00
parent 723ed25edb
commit 30c87225c0
2 changed files with 7 additions and 1 deletions

View file

@ -1,2 +1,2 @@
ietfparse>=1.4,<1.5
ietfparse>=1.5.1,<2
tornado>=5,<6

View file

@ -317,6 +317,9 @@ class ContentMixin:
acceptable, settings.available_content_types)
self._best_response_match = '/'.join(
[selected.content_type, selected.content_subtype])
if selected.content_suffix is not None:
self._best_response_match = '+'.join(
[self._best_response_match, selected.content_suffix])
except errors.NoMatch:
self._best_response_match = settings.default_content_type
@ -340,6 +343,9 @@ class ContentMixin:
settings.default_content_type))
content_type = '/'.join([content_type_header.content_type,
content_type_header.content_subtype])
if content_type_header.content_suffix is not None:
content_type = '+'.join([content_type,
content_type_header.content_suffix])
try:
handler = settings[content_type]
except KeyError: