Skip to content

Commit 31e1847

Browse files
committed
Bug-fix in expression parser
Tried to get minimum of an empty list. Add a test for this.
1 parent a12b199 commit 31e1847

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

roundup/hyperdb.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,8 @@ def set_val(self, val, force=False, result=True):
802802
self.val = list(vals)
803803
else:
804804
assert self.cls
805-
is_expression = min(int(i) for i in self.val) < -1
805+
is_expression = \
806+
self.val and min(int(i) for i in self.val) < -1
806807
if is_expression:
807808
# Tag on the ORed values with an AND
808809
l = val

test/db_test_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,9 @@ def testFilteringLink(self):
18521852
grp = (None, None)
18531853
for filt in iiter():
18541854
ae(filt(None, {'status': '1'}, ('+','id'), grp), ['2','3'])
1855+
ae(filt(None, {'status': [], 'status.name': 'unread'}), [])
18551856
ae(filt(None, {a: '-1'}, ('+','id'), grp), ['3','4'])
1857+
ae(filt(None, {a: []}, ('+','id'), grp), ['3','4'])
18561858
ae(filt(None, {a: None}, ('+','id'), grp), ['3','4'])
18571859
ae(filt(None, {a: [None]}, ('+','id'), grp), ['3','4'])
18581860
ae(filt(None, {a: ['-1', None]}, ('+','id'), grp), ['3','4'])

0 commit comments

Comments
 (0)