summaryrefslogtreecommitdiff
path: root/django/utils/text.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-05-05 19:47:03 +0200
committerClaude Paroz <claude@2xlibre.net>2012-05-05 21:41:44 +0200
commitd7dfab59ead97b35c6f6786784225f377783e376 (patch)
treed357f2b94ef010d60e9ad6602bda5537f1a28b8d /django/utils/text.py
parent1583d402240d88ad2a4acc024d348a21657ccaba (diff)
Replaced cStringIO.StringIO by io.BytesIO.
Also replaced StringIO.StringIO by BytesIO in some other appropriate places. StringIO is not available in Python 3.
Diffstat (limited to 'django/utils/text.py')
-rw-r--r--django/utils/text.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/django/utils/text.py b/django/utils/text.py
index f443b31a67..2ac101fcb8 100644
--- a/django/utils/text.py
+++ b/django/utils/text.py
@@ -3,11 +3,7 @@ import unicodedata
import warnings
from gzip import GzipFile
from htmlentitydefs import name2codepoint
-
-try:
- from cStringIO import StringIO
-except ImportError:
- from StringIO import StringIO
+from io import BytesIO
from django.utils.encoding import force_unicode
from django.utils.functional import allow_lazy, SimpleLazyObject
@@ -277,7 +273,7 @@ phone2numeric = allow_lazy(phone2numeric)
# From http://www.xhaus.com/alan/python/httpcomp.html#gzip
# Used with permission.
def compress_string(s):
- zbuf = StringIO()
+ zbuf = BytesIO()
zfile = GzipFile(mode='wb', compresslevel=6, fileobj=zbuf)
zfile.write(s)
zfile.close()