more unicode refactoring

This commit is contained in:
Miroslav Stampar
2010-06-02 12:45:40 +00:00
parent 2fb8bf3b6a
commit 12a5ec9f3d
16 changed files with 37 additions and 23 deletions

View File

@@ -94,7 +94,7 @@ def decodePage(page, encoding):
Decode gzip/deflate HTTP response
"""
if unicode(encoding).lower() in ('gzip', 'x-gzip', 'deflate'):
if isinstance(encoding, basestring) and encoding.lower() in ('gzip', 'x-gzip', 'deflate'):
if encoding == 'deflate':
# http://stackoverflow.com/questions/1089662/python-inflate-and-deflate-implementations
data = StringIO.StringIO(zlib.decompress(page, -15))