Commit 5acc25a5 authored by Klaus Wölfel's avatar Klaus Wölfel

Add api to get len() of Data Bucket Stream

parent 643ae22e
......@@ -51,10 +51,12 @@ class DataBucketStream(Document):
, PropertySheet.SortIndex
)
def __init__(self, id, **kw):
self.initTree()
Document.__init__(self, id, **kw)
def __len__(self):
return len(self._tree)
def initTree(self):
"""
......@@ -101,11 +103,12 @@ class DataBucketStream(Document):
return sequence
return sequence[:count]
def getBucketItemSequence(self, start_key=None, count=None):
def getBucketItemSequence(self, start_key=None, count=None,
exclude_start_key=False):
"""
Get a lazy sequence of bucket values
Get a lazy sequence of bucket items
"""
sequence = self._tree.items(min=start_key)
sequence = self._tree.items(min=start_key, excludemin=exclude_start_key)
if count is None:
return sequence
return sequence[:count]
......
......@@ -46,8 +46,8 @@
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 55, 21: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W: 65, 18: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W: 54, 21: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W: 67, 18: Redefining built-in \'id\' (redefined-builtin)</string>
</tuple>
</value>
</item>
......
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