Commit ab1d6229 authored by Vincent Pelletier's avatar Vincent Pelletier Committed by Sebastien Robin

Delay StringIO creation until actually needed.

parent 10c717d3
......@@ -55,14 +55,14 @@ class BTreeData(Persistent):
def read(self, offset, size):
start_offset = offset
tree = self.tree
result = StringIO()
write = result.write
try:
key = tree.maxKey(offset)
except ValueError:
return ''
else:
offset -= key
result = StringIO()
write = result.write
written = 0
for key in tree.iterkeys(key):
padding = min(size, key - start_offset - written)
......
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