changeset 3362:5126627029d6 maint-0.8

merge from HEAD
author Richard Jones <richard@users.sourceforge.net>
date Fri, 24 Jun 2005 05:45:36 +0000
parents 2f8f4877be65
children 9795ec63ff0f
files CHANGES.txt roundup/cgi/templating.py
diffstat 2 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Fri Jun 24 05:34:15 2005 +0000
+++ b/CHANGES.txt	Fri Jun 24 05:45:36 2005 +0000
@@ -14,6 +14,7 @@
 - fix invocation of hasPermission from templating code (sf bug 1224172)
 - have 'roundup-admin security' display property restrictions (sf bug
   1222135)
+- fixed templating menu() sort_on handling (sf bug 1221936)
 
 
 2005-05-02 0.8.3
--- a/roundup/cgi/templating.py	Fri Jun 24 05:34:15 2005 +0000
+++ b/roundup/cgi/templating.py	Fri Jun 24 05:45:36 2005 +0000
@@ -1621,7 +1621,9 @@
             "additional" lists properties which should be included in the
                 label
             "sort_on" indicates the property to sort the list on as
-                (direction, property) where direction is '+' or '-'.
+                (direction, property) where direction is '+' or '-'. A
+                single string with the direction prepended may be used.
+                For example: ('-', 'order'), '+name'.
 
             The remaining keyword arguments are used as conditions for
             filtering the items in the list - they're passed as the
@@ -1641,13 +1643,16 @@
         if value is None:
             s = 'selected="selected" '
         l.append(self._('<option %svalue="-1">- no selection -</option>')%s)
-        if linkcl.getprops().has_key('order'):
+        if sort_on is not None:
+            if not isinstance(sort_on, tuple):
+                if sort_on[0] in '+-':
+                    sort_on = (sort_on[0], sort_on[1:])
+                else:
+                    sort_on = ('+', sort_on)
+        elif linkcl.getprops().has_key('order'):
             sort_on = ('+', 'order')
         else:
-            if sort_on is None:
-                sort_on = ('+', linkcl.labelprop())
-            else:
-                sort_on = ('+', sort_on)
+            sort_on = ('+', linkcl.labelprop())
         options = linkcl.filter(None, conditions, sort_on, (None, None))
 
         # make sure we list the current value if it's retired

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