diff roundup/cgi/templating.py @ 4032:a73bac81eda2

Fix issue2550500
author Stefan Seefeld <stefan@seefeld.name>
date Thu, 12 Feb 2009 05:10:59 +0000
parents 797eacd945af
children b6a2251394dd
line wrap: on
line diff
--- a/roundup/cgi/templating.py	Thu Feb 12 05:07:00 2009 +0000
+++ b/roundup/cgi/templating.py	Thu Feb 12 05:10:59 2009 +0000
@@ -695,7 +695,7 @@
             if 'username' in properties.split( ',' ):
                 sort = 'username'
             else:
-                sort = find_sort_key(self._klass)
+                sort = self._klass.orderprop()
         sort = '&amp;@sort=' + sort
         if property:
             property = '&amp;property=%s'%property
@@ -1891,7 +1891,7 @@
                 else:
                     sort_on = ('+', sort_on)
         else:
-            sort_on = ('+', find_sort_key(linkcl))
+            sort_on = ('+', linkcl.orderprop())
 
         options = [opt
             for opt in linkcl.filter(None, conditions, sort_on, (None, None))
@@ -2077,7 +2077,7 @@
                 else:
                     sort_on = ('+', sort_on)
         else:
-            sort_on = ('+', find_sort_key(linkcl))
+            sort_on = ('+', linkcl.orderprop())
 
         options = [opt
             for opt in linkcl.filter(None, conditions, sort_on)
@@ -2139,17 +2139,11 @@
     """
     linkcl = db.getclass(classname)
     if sort_on is None:
-        sort_on = find_sort_key(linkcl)
+        sort_on = linkcl.orderprop()
     def sortfunc(a, b):
         return cmp(linkcl.get(a, sort_on), linkcl.get(b, sort_on))
     return sortfunc
 
-def find_sort_key(linkcl):
-    if linkcl.getprops().has_key('order'):
-        return 'order'
-    else:
-        return linkcl.labelprop()
-
 def handleListCGIValue(value):
     """ Value is either a single item or a list of items. Each item has a
         .value that we're actually interested in.

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