diff options
author | Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> | 2012-06-29 02:35:12 +0200 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2012-06-29 08:50:25 -0400 |
commit | 2e80fd31bf94d67944af1bd44491cf67ef08bb06 (patch) | |
tree | 98f566d8a9cb1d899b66842306d6e2bd5dd03abd | |
parent | Update WebappConfig.version.WCVERSION. (diff) | |
download | webapp-config-2e80fd31bf94d67944af1bd44491cf67ef08bb06.tar.gz webapp-config-2e80fd31bf94d67944af1bd44491cf67ef08bb06.tar.bz2 webapp-config-2e80fd31bf94d67944af1bd44491cf67ef08bb06.zip |
Do not use cmp() for compatibility with Python 3.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
-rw-r--r-- | WebappConfig/content.py | 13 | ||||
-rw-r--r-- | WebappConfig/db.py | 2 |
2 files changed, 2 insertions, 13 deletions
diff --git a/WebappConfig/content.py b/WebappConfig/content.py index 4e0462b..8e92622 100644 --- a/WebappConfig/content.py +++ b/WebappConfig/content.py @@ -548,19 +548,8 @@ class Contents: ''' Get a list of files. This is returned as a list sorted according to length, so that files lower in the hierarchy can be removed first.''' - def lencmp(x, y): - zx = len(x) - zy = len(y) - if zx > zy: - return -1 - if zy > zx: - return 1 - return cmp(x, y) - installed = self.__content.keys() - installed.sort(lencmp) - - return installed + return sorted(installed, key=lambda x: (-len(x), x)) def get_directories(self): ''' Get only the directories as a sorted list.''' diff --git a/WebappConfig/db.py b/WebappConfig/db.py index ccb7b0e..c925792 100644 --- a/WebappConfig/db.py +++ b/WebappConfig/db.py @@ -202,7 +202,7 @@ class WebappDB(AppHierarchy): varies whith your code location) >>> sb = [i[1] for i in b.list_locations().items()] - >>> sb.sort(lambda x,y: cmp(x[0]+x[1]+x[2],y[0]+y[1]+y[2])) + >>> sb.sort(key=lambda x: x[0]+x[1]+x[2]) >>> sb [['', 'gallery', '1.4.4_p6'], ['', 'gallery', '2.0_rc2'], ['', 'horde', '3.0.5'], ['', 'phpldapadmin', '0.9.7_alpha4']] |