comparison roundup/cgi/templating.py @ 7122:94a5a9e6f0d2

Fix traceback on integer order attribute, fix comment Ralf Schlatterbeck's commit cb39a6c95cd3 did not include hyperdb.Integer support. This commit adds it. Also fixes associated comment.
author John Rouillard <rouilj@ieee.org>
date Sat, 21 Jan 2023 12:52:24 -0500
parents cb39a6c95cd3
children 82bbb95e5690 d267b0454500
comparison
equal deleted inserted replaced
7121:cb39a6c95cd3 7122:94a5a9e6f0d2
2950 prop = linkcl.getprops()[sort_on] 2950 prop = linkcl.getprops()[sort_on]
2951 2951
2952 def keyfunc(a): 2952 def keyfunc(a):
2953 if num_re.match(a): 2953 if num_re.match(a):
2954 a = linkcl.get(a, sort_on) 2954 a = linkcl.get(a, sort_on)
2955 # In Python3 we may not compare strings and None 2955 # In Python3 we may not compare numbers/strings and None
2956 if a is None: 2956 if a is None:
2957 if isinstance(prop, hyperdb.Number): 2957 if isinstance(prop, (hyperdb.Number, hyperdb.Integer)):
2958 return 0 2958 return 0
2959 return '' 2959 return ''
2960 return a 2960 return a
2961 return keyfunc 2961 return keyfunc
2962 2962

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