diff options
author | Cyril Roelandt <cyril.roelandt@enovance.com> | 2014-03-18 12:37:35 +0100 |
---|---|---|
committer | Cyril Roelandt <cyril.roelandt@enovance.com> | 2014-03-18 12:37:35 +0100 |
commit | 9bab66a51910d0eb171c55d35ab3737ac0eeb0aa (patch) | |
tree | 1ced18dac373beddf9139d5feabc96da31442440 /paste | |
parent | f38b5dc9b8742db9adaa36bb8b878d6628590d39 (diff) | |
download | paste-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')
-rw-r--r-- | paste/util/dateinterval.py | 5 | ||||
-rw-r--r-- | paste/wsgilib.py | 2 |
2 files changed, 4 insertions, 3 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) diff --git a/paste/wsgilib.py b/paste/wsgilib.py index 0111113..879a43e 100644 --- a/paste/wsgilib.py +++ b/paste/wsgilib.py @@ -406,7 +406,7 @@ def dump_environ(environ, start_response): variables out as a plain text response. """ output = [] - keys = environ.keys() + keys = list(environ.keys()) keys.sort() for k in keys: v = str(environ[k]).replace("\n","\n ") |