Commit fe4990a3 authored by Hanno Schlichting's avatar Hanno Schlichting

Simplify the sort code

parent 93a7551b
...@@ -16,6 +16,7 @@ $Id$ ...@@ -16,6 +16,7 @@ $Id$
""" """
import logging import logging
import operator
import sys import sys
import string import string
import time import time
...@@ -1008,7 +1009,7 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -1008,7 +1009,7 @@ class ZCatalog(Folder, Persistent, Implicit):
def delColumn(self, name): def delColumn(self, name):
return self._catalog.delColumn(name) return self._catalog.delColumn(name)
# #
# Catalog report methods # Catalog report methods
# #
...@@ -1017,11 +1018,7 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -1017,11 +1018,7 @@ class ZCatalog(Folder, Persistent, Implicit):
def getCatalogReport(self): def getCatalogReport(self):
""" Reports about the duration of queries """ """ Reports about the duration of queries """
rval = self._catalog.getCatalogReport().report() rval = self._catalog.getCatalogReport().report()
rval.sort(key=operator.itemgetter('duration'), reverse=True)
sort_by = 'duration'
rval.sort(lambda e1, e2, sort_by=sort_by:
cmp(e1[sort_by], e2[sort_by]))
rval.reverse()
return rval return rval
security.declareProtected(manage_zcatalog_entries, security.declareProtected(manage_zcatalog_entries,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment