@@ -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