Commit 2b5dcd89 authored by Vincent Pelletier's avatar Vincent Pelletier

Store uncompressed data if compressed data is bigger.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1820 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent f949240a
...@@ -556,8 +556,13 @@ class Application(object): ...@@ -556,8 +556,13 @@ class Application(object):
# this is a George Bailey object, stored as an empty string # this is a George Bailey object, stored as an empty string
data = '' data = ''
compressed_data = compress(data) compressed_data = compress(data)
if len(compressed_data) > data:
compressed_data = data
compression = 0
else:
compression = 1
checksum = makeChecksum(compressed_data) checksum = makeChecksum(compressed_data)
p = Packets.AskStoreObject(oid, serial, 1, p = Packets.AskStoreObject(oid, serial, compression,
checksum, compressed_data, self.local_var.tid) checksum, compressed_data, self.local_var.tid)
# Store object in tmp cache # Store object in tmp cache
self.local_var.data_dict[oid] = data self.local_var.data_dict[oid] = data
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment