Skip to content

Commit e0b056e

Browse files
committed
Fix Traceback on empty numeric order attribute
1 parent 9b19280 commit e0b056e

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ Fixed:
6161
- issue2551250: Fix sorting of detectors even if there are two with the
6262
same name and priority (can happen if they are created in two
6363
different files).
64+
- Fix Traceback when a numeric order attribute is empty (Ralf
65+
Schlatterbeck)
6466

6567
Features:
6668

roundup/cgi/templating.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2947,12 +2947,15 @@ def make_key_function(db, classname, sort_on=None):
29472947
linkcl = db.getclass(classname)
29482948
if sort_on is None:
29492949
sort_on = linkcl.orderprop()
2950+
prop = linkcl.getprops()[sort_on]
29502951

29512952
def keyfunc(a):
29522953
if num_re.match(a):
29532954
a = linkcl.get(a, sort_on)
29542955
# In Python3 we may not compare strings and None
29552956
if a is None:
2957+
if isinstance(prop, hyperdb.Number):
2958+
return 0
29562959
return ''
29572960
return a
29582961
return keyfunc

0 commit comments

Comments
 (0)