Skip to content

Commit

Permalink
Merge pull request jazzband#715 from benspaulding/mimetypes-str
Browse files Browse the repository at this point in the history
Keep mimetypes as str on all versions of Python
  • Loading branch information
Buky authored May 23, 2020
2 parents 46833c6 + 9f08147 commit 44eeb9d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ or just made Pipeline more awesome.
* Austin Pua <[email protected]>
* Axel Haustant <[email protected]>
* Balazs Kossovics <[email protected]>
* Ben Spaulding <[email protected]>
* Ben Vinegar <[email protected]>
* Brad Pitcher <[email protected]>
* Brant Young <[email protected]>
Expand Down
10 changes: 5 additions & 5 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ Tuple that match file extension with their corresponding mimetypes.
Defaults to ::

(
(b'text/coffeescript', '.coffee'),
(b'text/less', '.less'),
(b'text/javascript', '.js'),
(b'text/x-sass', '.sass'),
(b'text/x-scss', '.scss')
('text/coffeescript', '.coffee'),
('text/less', '.less'),
('text/javascript', '.js'),
('text/x-sass', '.sass'),
('text/x-scss', '.scss')
)

.. warning::
Expand Down
10 changes: 5 additions & 5 deletions pipeline/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@
'LESS_ARGUMENTS': '',

'MIMETYPES': (
(b'text/coffeescript', '.coffee'),
(b'text/less', '.less'),
(b'text/javascript', '.js'),
(b'text/x-sass', '.sass'),
(b'text/x-scss', '.scss')
(str('text/coffeescript'), str('.coffee')),
(str('text/less'), str('.less')),
(str('text/javascript'), str('.js')),
(str('text/x-sass'), str('.sass')),
(str('text/x-scss'), str('.scss'))
),

'EMBED_MAX_IMAGE_SIZE': 32700,
Expand Down
10 changes: 10 additions & 0 deletions tests/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import mimetypes

from django.test import TestCase

from pipeline.utils import guess_type
Expand All @@ -8,3 +13,8 @@ def test_guess_type(self):
self.assertEqual('text/css', guess_type('stylesheet.css'))
self.assertEqual('text/coffeescript', guess_type('application.coffee'))
self.assertEqual('text/less', guess_type('stylesheet.less'))

def test_mimetypes_are_str(self):
for ext, mtype in mimetypes.types_map.items():
self.assertIsInstance(ext, str)
self.assertIsInstance(mtype, str)

0 comments on commit 44eeb9d

Please sign in to comment.