Skip to content

Commit f06a1bc

Browse files
authored
Merge pull request carbonblack#242 from crahan/alertquery_len_fix
Add missing __len__() implementation for IterableQueryMixin to fix len() on Alert query
2 parents 3d81184 + 420656f commit f06a1bc

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/cbapi/psc/alerts_query.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ def __init__(self, doc_class, cb):
2424
self._time_filter = {}
2525
self._sortcriteria = {}
2626
self._bulkupdate_url = "/appservices/v6/orgs/{0}/alerts/workflow/_criteria"
27+
self._count_valid = False
28+
self._total_results = 0
2729

2830
def _update_criteria(self, key, newlist):
2931
"""

src/cbapi/psc/base_query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def one(self):
261261
return res[0]
262262

263263
def __len__(self):
264-
return 0
264+
return self._count()
265265

266266
def __getitem__(self, item):
267267
return None

0 commit comments

Comments
 (0)