Mercurial > p > roundup > code
changeset 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 | a67a8a6535b8 |
| children | 572bbe7fa236 |
| files | roundup/cgi/templating.py |
| diffstat | 1 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/roundup/cgi/templating.py Thu Apr 07 06:38:38 2005 +0000 +++ b/roundup/cgi/templating.py Thu Apr 07 07:06:24 2005 +0000 @@ -1622,7 +1622,7 @@ label "sort_on" indicates the property to sort the list on as (direction, property) where direction is '+' or '-'. - + The remaining keyword arguments are used as conditions for filtering the items in the list - they're passed as the "filterspec" argument to a Class.filter() call. @@ -1698,10 +1698,17 @@ def __init__(self, *args, **kwargs): HTMLProperty.__init__(self, *args, **kwargs) if self._value: - self._value = lookupIds(self._db, self._prop, self._value, + display_value = lookupIds(self._db, self._prop, self._value, fail_ok=1) sortfun = make_sort_function(self._db, self._prop.classname) - self._value.sort(sortfun) + # sorting fails if the value contains + # items not yet stored in the database + # ignore these errors to preserve user input + try: + display_value.sort(sortfun) + except: + pass + self_value = display_value def __len__(self): ''' length of the multilink ''' @@ -1794,7 +1801,7 @@ label "sort_on" indicates the property to sort the list on as (direction, property) where direction is '+' or '-'. - + The remaining keyword arguments are used as conditions for filtering the items in the list - they're passed as the "filterspec" argument to a Class.filter() call.
