Index mod_python py --- mod_python py revision 7609 mod_python py work

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
Index: mod_python.py
===================================================================
--- mod_python.py (revision 7609)
+++ mod_python.py (working copy)
@@ -200,9 +200,12 @@
return storage.get('style', None).file.read()
def _read_style_gzip(storage):
- style = StringIO(urllib.unquote_plus(storage.get('style', None).file.read()))
- return gzip.GzipFile(fileobj=style, mode='r').read()
-
+ data = storage.get('style', None).file.read()
+ try:
+ return gzip.GzipFile(fileobj=StringIO(urllib.unquote_plus(data)), mode='r').read()
+ except gzip.zlib.error:
+ return gzip.GzipFile(fileobj=StringIO(data), mode='r').read()
+
@accepts('POST')
@check_session
def refresh(req):