mirror of
https://github.com/sprockets/sprockets.mixins.mediatype.git
synced 2024-12-29 11:17:10 +00:00
Fix Python 3 issues.
This commit is contained in:
parent
7e12355311
commit
e99e430806
2 changed files with 14 additions and 2 deletions
|
@ -6,7 +6,7 @@ sprockets.mixins.media_type
|
|||
import logging
|
||||
|
||||
from ietfparse import algorithms, errors, headers
|
||||
from tornado import web
|
||||
from tornado import escape, web
|
||||
|
||||
|
||||
version_info = (0, 0, 0)
|
||||
|
@ -256,7 +256,8 @@ class _TextContentHandler(object):
|
|||
def to_bytes(self, data_dict, encoding=None):
|
||||
selected = encoding or self.default_encoding
|
||||
content_type = '{0}; charset="{1}"'.format(self.content_type, selected)
|
||||
return content_type, self._dumps(data_dict).encode(selected)
|
||||
dumped = self._dumps(escape.recursive_unicode(data_dict))
|
||||
return content_type, dumped.encode(selected)
|
||||
|
||||
def from_bytes(self, data, encoding=None):
|
||||
return self._loads(data.decode(encoding or self.default_encoding))
|
||||
|
|
11
tox.ini
Normal file
11
tox.ini
Normal file
|
@ -0,0 +1,11 @@
|
|||
[tox]
|
||||
envlist = py27,py34
|
||||
indexserver =
|
||||
default = https://pypi.python.org/simple
|
||||
toxworkdir = build/tox
|
||||
|
||||
[testenv]
|
||||
deps =
|
||||
-rrequires/installation.txt
|
||||
-rrequires/testing.txt
|
||||
commands = nosetests []
|
Loading…
Reference in a new issue