390c390 < from string import find, atoi, join --- > from string import find, atoi, join, split 703c703,759 < def sort_sequence(self, sequence): --- > def sort_sequence(self, sequence): > ''' > hacks to support multiple sort fields > april 7 ross lazarus rossl@med.usyd.edu.au > eg> all keys are converted to strings > since integers and so on can't be appended... > Highly experimental and dangerous - use at your own risk > Please let me know how it goes - I'll submit a patch to > the collector when enough people have tried it. > ''' > > sort=self.sort > sortfields = split(sort,',') # multi sort = key1,key2 > multsort = len(sortfields) > 1 # is multiple sort > mapping=self.mapping > isort=not sort > s=[] > for client in sequence: > k = '' > if type(client)==TupleType and len(client)==2: > if isort: k=client[0] > v=client[1] > else: > if isort: k=client > v=client > > if sort: > if multsort: # more than one sort key ? > for sk in sortfields: > if mapping: # can't do this? > akey = v[sk] # str hack - not needed if string? > else: > akey =getattr(v, sk) > if not basic_type(akey): > try: akey=akey() > except: pass > if type(akey) <> type(''): > akey = str(akey) > k = k + akey > else: # original code > if mapping: k=v[sort] > else: k=getattr(v, sort) > if not basic_type(k): > try: k=k() > except: pass > > s.append((k,client)) > > s.sort() > > sequence=[] > for k, client in s: > sequence.append(client) > return sequence > > def osort_sequence(self, sequence):