summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a5ca9cd)
raw | patch | inline | side by side (parent: a5ca9cd)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 10 Sep 2010 06:32:04 +0000 (06:32 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 10 Sep 2010 06:32:04 +0000 (06:32 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4523 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/cgi/templating.py | patch | blob | history |
index a08dbcd85729d055777098c8e9e9174f91a17d00..2d8ea77b64ca40273cc99cfa8316644057c3d6b1 100644 (file)
def make_sort_function(db, classname, sort_on=None):
- """Make a sort function for a given class
+ """Make a sort function for a given class.
+
+ The list being sorted may contain mixed ids and labels.
"""
linkcl = db.getclass(classname)
if sort_on is None:
sort_on = linkcl.orderprop()
def sortfunc(a, b):
- return cmp(linkcl.get(a, sort_on), linkcl.get(b, sort_on))
+ if num_re.match(a):
+ a = linkcl.get(a, sort_on)
+ if num_re.match(b):
+ b = linkcl.get(b, sort_on)
+ return cmp(a, b)
return sortfunc
def handleListCGIValue(value):