Mercurial > hg > MPIWGWeb
diff MPIWGRoot.py @ 180:a6739bb6a575
add reverse sorting of Features
author | casties |
---|---|
date | Wed, 12 Jun 2013 14:52:29 +0200 |
parents | 47392bf3fcba |
children | a8d5ba6729f3 |
line wrap: on
line diff
--- a/MPIWGRoot.py Wed Jun 12 10:37:10 2013 +0200 +++ b/MPIWGRoot.py Wed Jun 12 14:52:29 2013 +0200 @@ -155,14 +155,14 @@ getPathStyle = MPIWGHelper.getPathStyle - def getFeatures(self, num=None): + def getFeatures(self, num=None, reverse=False): """returns a list of the last num Features""" dir = getattr(self, 'features', None) if dir is None: return [] items = dir.objectValues(spec='MPIWGFeature') - items.sort(key=lambda x:int(x.weight)) + items.sort(key=lambda x:int(x.weight), reverse=reverse) if num is not None: # take only the last num elements items = items[-num:]