comparison roundup/cgi/templating.py @ 3270:e4607e12d030

ignore sorting errors in MultilinkHTMLProperty instantiation [SF#1177602]
author Alexander Smishlajev <a1s@users.sourceforge.net>
date Thu, 07 Apr 2005 07:06:24 +0000
parents 34d034a4c0d9
children 572bbe7fa236
comparison
equal deleted inserted replaced
3269:a67a8a6535b8 3270:e4607e12d030
1620 "showid" includes the item ids in the list labels 1620 "showid" includes the item ids in the list labels
1621 "additional" lists properties which should be included in the 1621 "additional" lists properties which should be included in the
1622 label 1622 label
1623 "sort_on" indicates the property to sort the list on as 1623 "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 '-'.
1625 1625
1626 The remaining keyword arguments are used as conditions for 1626 The remaining keyword arguments are used as conditions for
1627 filtering the items in the list - they're passed as the 1627 filtering the items in the list - they're passed as the
1628 "filterspec" argument to a Class.filter() call. 1628 "filterspec" argument to a Class.filter() call.
1629 1629
1630 If not editable, just display the value via plain(). 1630 If not editable, just display the value via plain().
1696 each entry in the multilink. 1696 each entry in the multilink.
1697 ''' 1697 '''
1698 def __init__(self, *args, **kwargs): 1698 def __init__(self, *args, **kwargs):
1699 HTMLProperty.__init__(self, *args, **kwargs) 1699 HTMLProperty.__init__(self, *args, **kwargs)
1700 if self._value: 1700 if self._value:
1701 self._value = lookupIds(self._db, self._prop, self._value, 1701 display_value = lookupIds(self._db, self._prop, self._value,
1702 fail_ok=1) 1702 fail_ok=1)
1703 sortfun = make_sort_function(self._db, self._prop.classname) 1703 sortfun = make_sort_function(self._db, self._prop.classname)
1704 self._value.sort(sortfun) 1704 # sorting fails if the value contains
1705 # items not yet stored in the database
1706 # ignore these errors to preserve user input
1707 try:
1708 display_value.sort(sortfun)
1709 except:
1710 pass
1711 self_value = display_value
1705 1712
1706 def __len__(self): 1713 def __len__(self):
1707 ''' length of the multilink ''' 1714 ''' length of the multilink '''
1708 return len(self._value) 1715 return len(self._value)
1709 1716
1792 "showid" includes the item ids in the list labels 1799 "showid" includes the item ids in the list labels
1793 "additional" lists properties which should be included in the 1800 "additional" lists properties which should be included in the
1794 label 1801 label
1795 "sort_on" indicates the property to sort the list on as 1802 "sort_on" indicates the property to sort the list on as
1796 (direction, property) where direction is '+' or '-'. 1803 (direction, property) where direction is '+' or '-'.
1797 1804
1798 The remaining keyword arguments are used as conditions for 1805 The remaining keyword arguments are used as conditions for
1799 filtering the items in the list - they're passed as the 1806 filtering the items in the list - they're passed as the
1800 "filterspec" argument to a Class.filter() call. 1807 "filterspec" argument to a Class.filter() call.
1801 1808
1802 If not editable, just display the value via plain(). 1809 If not editable, just display the value via plain().

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