21 Apr
2003
21 Apr
'03
4:23 p.m.
Casey, thanks for the snippet of code. It solves the problem perfectly. -Mike On Mon, 2003-04-21 at 10:31, Casey Duncan wrote:
You could write a general purpose sorting script as follows:
##Script (Python) "multiSort" ##parameters=objects, *sort_attrs ##title=Sort a list of objects by one or more of their attributes
results = [] for object in objects: row = [getattr(object, attr) for attr in sort_attrs] row.append(object) results.append(tuple(row)) results.sort() return [row[-1] for row in results]
hth,
-Casey -- Michael Long <mlong@datalong.com>