Commit d3abf4fa authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 13f4b6df
......@@ -183,7 +183,7 @@ class Bucket(object):
return (a.keyv == b.keyv and a.valuev == b.valuev)
def __str__(b):
if b.values is None:
if b.valuev is None:
kvv = ['%s' % k for k in b.keyv]
else:
assert len(b.keyv) == len(b.valuev)
......@@ -500,6 +500,8 @@ def Restructure(ztree, newStructure):
# specified keys and btree depth up-to maxdepth. Each tree node is split by
# up-to maxsplit points.
#
# Generated trees contains Buckets with only keys.
#
# If allowEmptyBuckets=y tree structures with empty buckets are also generated.
# By default, except for empty-tree case, only tree structures with non-empty
# buckets are generated, because ZODB BTree package misbehaves if it finds an
......@@ -522,7 +524,7 @@ def AllStructs(keys, maxdepth, maxsplit, allowEmptyBuckets=False): # -> i[] of T
else:
# the only possible case for empty tree is T/B
if not allowEmptyBuckets:
yield Tree([], Bucket()) # XXX -> !values
yield Tree([], Bucket([], None))
return
# XXX ok? (ideally should be -inf,+inf)
......@@ -559,7 +561,7 @@ def _allStructs(klo, khi, keyv, maxdepth, maxsplit, allowEmptyBuckets):
bkeyv = _keyvSliceBy(keyv, xlo, xhi)
if not allowEmptyBuckets:
assert len(bkeyv) > 0
children.append(Bucket(*bkeyv)) # XXX -> !values
children.append(Bucket(bkeyv, None))
else:
yield Tree(ksplitv[1:-1], *children) # (s1, s2, ..., sN)
......
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