mirror of
https://github.com/django/django.git
synced 2025-09-22 02:02:46 +00:00
Replaced cStringIO.StringIO by io.BytesIO.
Also replaced StringIO.StringIO by BytesIO in some other appropriate places. StringIO is not available in Python 3.
This commit is contained in:
parent
1583d40224
commit
d7dfab59ea
26 changed files with 94 additions and 167 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue