From f5638c8f6bdaff2daaa16f5e0b6df56d7d03e79a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonel=20C=C3=A2mara?= Date: Thu, 27 Sep 2018 16:22:48 +0100 Subject: [PATCH] Python 3 has no cmp function in sorted --- gluon/languages.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gluon/languages.py b/gluon/languages.py index 72167bcd..42a24f2c 100644 --- a/gluon/languages.py +++ b/gluon/languages.py @@ -311,7 +311,7 @@ def write_plural_dict(filename, contents): try: fp = LockedFile(filename, 'w') fp.write('#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n{\n# "singular form (0)": ["first plural form (1)", "second plural form (2)", ...],\n') - for key in sorted(contents, cmp=sort_function): + for key in sorted(contents, key=sort_function): forms = '[' + ','.join([repr(Utf8(form)) for form in contents[key]]) + ']' fp.write('%s: %s,\n' % (repr(Utf8(key)), forms)) @@ -326,7 +326,7 @@ def write_plural_dict(filename, contents): def sort_function(x, y): - return cmp(unicode(x, 'utf-8').lower(), unicode(y, 'utf-8').lower()) + return unicode(x, 'utf-8').lower() def write_dict(filename, contents):