uncompress_string

This one does the opposite of django’s compress_string function.

def uncompress_string(s):
    import cStringIO, gzip
    zbuf = cStringIO.StringIO(s)
    zfile = gzip.GzipFile(mode='r', fileobj=zbuf)
    return zfile.read()
Advertisements