summaryrefslogtreecommitdiff
path: root/paste/util
diff options
context:
space:
mode:
authorCyril Roelandt <cyril.roelandt@enovance.com>2014-03-18 12:37:35 +0100
committerCyril Roelandt <cyril.roelandt@enovance.com>2014-03-18 12:37:35 +0100
commit9bab66a51910d0eb171c55d35ab3737ac0eeb0aa (patch)
tree1ced18dac373beddf9139d5feabc96da31442440 /paste/util
parentf38b5dc9b8742db9adaa36bb8b878d6628590d39 (diff)
downloadpaste-9bab66a51910d0eb171c55d35ab3737ac0eeb0aa.tar.gz
Python 3: fix sort
* Use key parameter of sort() * Convert dict.items() to list, needed by Python 3
Diffstat (limited to 'paste/util')
-rw-r--r--paste/util/dateinterval.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/paste/util/dateinterval.py b/paste/util/dateinterval.py
index 2195ab2..5109e28 100644
--- a/paste/util/dateinterval.py
+++ b/paste/util/dateinterval.py
@@ -30,8 +30,9 @@ timeValues = {
'm': minute,
's': second,
}
-timeOrdered = timeValues.items()
-timeOrdered.sort(lambda a, b: -cmp(a[1], b[1]))
+timeOrdered = list(timeValues.items())
+timeOrdered.sort(key=lambda x: x[1], reverse=True)
+
def interval_encode(seconds, include_sign=False):
"""Encodes a number of seconds (representing a time interval)