[jhbuild/pre-3-cleanup: 7/16] Don't handle a missing gzip module
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild/pre-3-cleanup: 7/16] Don't handle a missing gzip module
- Date: Sun, 22 Sep 2019 10:37:54 +0000 (UTC)
commit 630d927115f93a530cd8a3ee065d5d180fde4966
Author: Christoph Reiter <reiter christoph gmail com>
Date: Sat Sep 21 22:28:34 2019 +0200
Don't handle a missing gzip module
It's in the stdlib and there are no docs indicating that it's optional.
jhbuild/utils/httpcache.py | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/jhbuild/utils/httpcache.py b/jhbuild/utils/httpcache.py
index 8904fd4d..5f92939d 100644
--- a/jhbuild/utils/httpcache.py
+++ b/jhbuild/utils/httpcache.py
@@ -35,10 +35,7 @@ import urlparse
import time
import rfc822
import StringIO
-try:
- import gzip
-except ImportError:
- gzip = None
+import gzip
try:
import xml.dom.minidom
@@ -188,8 +185,7 @@ class Cache:
raise RuntimeError(_('file not in cache, but not allowed to check network'))
request = urllib2.Request(uri)
- if gzip:
- request.add_header('Accept-encoding', 'gzip')
+ request.add_header('Accept-encoding', 'gzip')
if entry:
if entry.modified:
request.add_header('If-Modified-Since', entry.modified)
@@ -201,7 +197,7 @@ class Cache:
# get data, and gunzip it if it is encoded
data = response.read()
- if gzip and response.headers.get('Content-Encoding', '') == 'gzip':
+ if response.headers.get('Content-Encoding', '') == 'gzip':
try:
data = gzip.GzipFile(fileobj=StringIO.StringIO(data)).read()
except:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]