コード例 #1
0
ファイル: text_buglist.py プロジェクト: armooo/oh-mainline
 def sort(self, optsort):
     """ returns a list of bug objects sorted by optsort
     if one of the element in the list is an instance of LPBugInfo
     the list can only be sorted by the bugnumber """
     attribute = optsort.strip("-")
     m = filter(lambda x: isinstance(x, LPBugInfo), self)
     if m and not attribute == "nr":
         raise TypeError, "text buglists containing LPBugInfo objects can only be sorted by nr"
     cmp_func = lambda x, y: sort(x, y, attribute)
     isreverse = optsort.startswith("-")
     return sorted(self, cmp=cmp_func, reverse=isreverse)
コード例 #2
0
ファイル: html_buglist.py プロジェクト: armooo/oh-mainline
 def sort(self, optsort):
     cmp_func = lambda x, y: sort(x, y, optsort.strip("-"))
     isreverse = optsort.startswith("-")
     return sorted(self, cmp=cmp_func, reverse=isreverse)