diff options
author | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-03-29 16:47:01 -0700 |
---|---|---|
committer | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-03-29 16:47:01 -0700 |
commit | 48507954f5806f073ad4d913edc919dc92d933e9 (patch) | |
tree | b08b5af77fddc35e4e06ec178283e916bce4dd14 /scss/types.py | |
parent | e97461c577435fcb1e19da39e19af48437ea591f (diff) | |
download | pyscss-48507954f5806f073ad4d913edc919dc92d933e9.tar.gz |
Make the internals all use unicode, even on py2.
This was happening on py3 anyway, so might as well try to be
Unicode-clean everywhere.
The CSS charset detection is not actually implemented yet.
Also, speedups are now totally broken on py2. Please hold.
Diffstat (limited to 'scss/types.py')
-rw-r--r-- | scss/types.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/scss/types.py b/scss/types.py index aafbab4..5e8f02a 100644 --- a/scss/types.py +++ b/scss/types.py @@ -1,9 +1,11 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function +from __future__ import unicode_literals import colorsys import operator +from warnings import warn import six @@ -989,6 +991,11 @@ class String(Value): value = str(value) if isinstance(value, six.binary_type): + warn(FutureWarning( + "String got a bytes type {0!r} " + "-- this will no longer be supported in pyScss 2.0" + .format(value) + )) value = value.decode(DEFAULT_STRING_ENCODING) if not isinstance(value, six.text_type): @@ -997,11 +1004,7 @@ class String(Value): # TODO probably disallow creating an unquoted string outside a # set of chars like [-a-zA-Z0-9]+ - if six.PY3: - self.value = value - else: - # TODO well, at least 3 uses unicode everywhere - self.value = value.encode(DEFAULT_STRING_ENCODING) + self.value = value self.quotes = quotes @classmethod |