Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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)