Skip to content

Commit d22a1c4

Browse files
author
Richard Jones
committed
merge from HEAD
1 parent b40df9c commit d22a1c4

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Fixed:
1414
- fix invocation of hasPermission from templating code (sf bug 1224172)
1515
- have 'roundup-admin security' display property restrictions (sf bug
1616
1222135)
17+
- fixed templating menu() sort_on handling (sf bug 1221936)
1718

1819

1920
2005-05-02 0.8.3

roundup/cgi/templating.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,7 +1621,9 @@ def menu(self, size=None, height=None, showid=0, additional=[],
16211621
"additional" lists properties which should be included in the
16221622
label
16231623
"sort_on" indicates the property to sort the list on as
1624-
(direction, property) where direction is '+' or '-'.
1624+
(direction, property) where direction is '+' or '-'. A
1625+
single string with the direction prepended may be used.
1626+
For example: ('-', 'order'), '+name'.
16251627
16261628
The remaining keyword arguments are used as conditions for
16271629
filtering the items in the list - they're passed as the
@@ -1641,13 +1643,16 @@ def menu(self, size=None, height=None, showid=0, additional=[],
16411643
if value is None:
16421644
s = 'selected="selected" '
16431645
l.append(self._('<option %svalue="-1">- no selection -</option>')%s)
1644-
if linkcl.getprops().has_key('order'):
1646+
if sort_on is not None:
1647+
if not isinstance(sort_on, tuple):
1648+
if sort_on[0] in '+-':
1649+
sort_on = (sort_on[0], sort_on[1:])
1650+
else:
1651+
sort_on = ('+', sort_on)
1652+
elif linkcl.getprops().has_key('order'):
16451653
sort_on = ('+', 'order')
16461654
else:
1647-
if sort_on is None:
1648-
sort_on = ('+', linkcl.labelprop())
1649-
else:
1650-
sort_on = ('+', sort_on)
1655+
sort_on = ('+', linkcl.labelprop())
16511656
options = linkcl.filter(None, conditions, sort_on, (None, None))
16521657

16531658
# make sure we list the current value if it's retired

0 commit comments

Comments
 (0)