##// END OF EJS Templates
fix UnboundLocalError, refactor a bit...
Benoit Boissinot -
r5453:9d77f2b4 default
parent child Browse files
Show More
@@ -62,10 +62,9 b' def compress(text):'
62 if not text:
62 if not text:
63 return ("", text)
63 return ("", text)
64 l = len(text)
64 l = len(text)
65 bin = None
65 if l < 44:
66 if l < 44:
66 if text[0] == '\0':
67 pass
67 return ("", text)
68 return ('u', text)
69 elif l > 1000000:
68 elif l > 1000000:
70 # zlib makes an internal copy, thus doubling memory usage for
69 # zlib makes an internal copy, thus doubling memory usage for
71 # large files, so lets do this in pieces
70 # large files, so lets do this in pieces
@@ -81,7 +80,7 b' def compress(text):'
81 bin = "".join(p)
80 bin = "".join(p)
82 else:
81 else:
83 bin = _compress(text)
82 bin = _compress(text)
84 if len(bin) > l:
83 if bin is None or len(bin) > l:
85 if text[0] == '\0':
84 if text[0] == '\0':
86 return ("", text)
85 return ("", text)
87 return ('u', text)
86 return ('u', text)
General Comments 0
You need to be logged in to leave comments. Login now