Make sure we send the extra zeros in chunks

This commit is contained in:
Joseph Schorr 2014-10-14 15:58:52 -04:00
parent 3b88ba7373
commit efb3c6c494
2 changed files with 10 additions and 3 deletions

View file

@ -1,5 +1,8 @@
from gzip import GzipFile
# 256K buffer to Gzip
GZIP_BUFFER_SIZE = 1024 * 256
class GzipWrap(object):
def __init__(self, input, filename=None, compresslevel=1):
self.input = iter(input)
@ -21,7 +24,7 @@ class GzipWrap(object):
input_size = 0
input_buffer = ''
while input_size < 1024 * 256: # 256K buffer to Gzip
while input_size < GZIP_BUFFER_SIZE:
try:
s = self.input.next()
input_buffer += s