--- a/src/pyams_catalog/query.py Fri Apr 27 10:34:21 2018 +0200
+++ b/src/pyams_catalog/query.py Tue Jan 08 14:02:47 2019 +0100
@@ -12,14 +12,9 @@
__docformat__ = 'restructuredtext'
-
-# import standard library
-
-# import interfaces
+from hypatia.query import Query
from zope.intid.interfaces import IIntIds
-# import packages
-from hypatia.query import Query
from pyams_utils.registry import query_utility
@@ -52,15 +47,18 @@
for item in self.last:
yield item
+ def __len__(self):
+ return len(self.first) + len(self.query) + len(self.last)
+
def prepend(self, items):
- if isinstance(items, CatalogResultSet):
- items = list(items)
- self.first.extend(items)
+ insert = self.first.insert
+ for index, item in enumerate(items):
+ insert(index, item)
def append(self, items):
- if isinstance(items, CatalogResultSet):
- items = list(items)
- self.last.extend(items)
+ append = self.last.append
+ for item in items:
+ append(item)
def or_(source, added):