On Mar 31, 2006, at 2:54 PM, Jesus Cea wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I'm using DURUS and my BerkeleyDB backend as a GIS repository. I store > tiled maps in the storage. I have about 50000 maps, of 500Kbytes each. > It works great. But since the images are stored compressed (PNG), I > would like to avoid the zlib inherent compression in Durus, for > performance reasons. > > The issue are not the "permanent" maps but the temporal ones, like "on > the fly" maps with tracks layered over them, and things like that. I > would rather prefer to not compress an already compressed PNG > generated > file. > > Any "documented" option?. > > I would like to be able to configure that, object by object. I'm aware > of "WRITE_COMPRESSED_STATE_PICKLES" attribute in "serialize.py", but I > would like to have a garantee of forward compatibility with future > Durus > releases. Here's what I would do. Set WRITE_COMPRESSED_STATE_PICKLES to False. Add __getstate__() and __setstate__() methods to your persistent classes that provide the customized compression behavior. If you want compressed pickles for a certain class, make the __getstate__() return a compressed pickle of self.__dict__ instead of the dict itself. The __setstate__() must have the corresponding inverse behavior.