diff roundup/cgi/templating.py @ 7121:cb39a6c95cd3

Fix Traceback on empty numeric order attribute
author Ralf Schlatterbeck <rsc@runtux.com>
date Thu, 19 Jan 2023 14:40:52 +0100
parents 2c89bdc88923
children 94a5a9e6f0d2
line wrap: on
line diff
--- a/roundup/cgi/templating.py	Sun Jan 08 01:44:59 2023 -0500
+++ b/roundup/cgi/templating.py	Thu Jan 19 14:40:52 2023 +0100
@@ -2947,12 +2947,15 @@
     linkcl = db.getclass(classname)
     if sort_on is None:
         sort_on = linkcl.orderprop()
+    prop = linkcl.getprops()[sort_on]
 
     def keyfunc(a):
         if num_re.match(a):
             a = linkcl.get(a, sort_on)
             # In Python3 we may not compare strings and None
             if a is None:
+                if isinstance(prop, hyperdb.Number):
+                    return 0
                 return ''
         return a
     return keyfunc

Roundup Issue Tracker: http://roundup-tracker.org/