From: Philip Jenvey Date: Fri, 25 Sep 2009 20:29:11 +0000 (+0000) Subject: remove sorted and don't assume dict ordering (Python 2.3 & Jython compat) X-Git-Tag: 1.0~250 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f95a8b8342879ca94f2f2ad970eae4a05045bb76;p=thirdparty%2Fbabel.git remove sorted and don't assume dict ordering (Python 2.3 & Jython compat) --- diff --git a/babel/localedata.py b/babel/localedata.py index 203bec80..9308b5ec 100644 --- a/babel/localedata.py +++ b/babel/localedata.py @@ -120,8 +120,8 @@ def merge(dict1, dict2): >>> d = {1: 'foo', 3: 'baz'} >>> merge(d, {1: 'Foo', 2: 'Bar'}) - >>> d - {1: 'Foo', 2: 'Bar', 3: 'baz'} + >>> items = d.items(); items.sort(); items + [(1, 'Foo'), (2, 'Bar'), (3, 'baz')] :param dict1: the dictionary to merge into :param dict2: the dictionary containing the data that should be merged diff --git a/babel/messages/frontend.py b/babel/messages/frontend.py index 501e68b9..b1ebfb4a 100755 --- a/babel/messages/frontend.py +++ b/babel/messages/frontend.py @@ -638,8 +638,9 @@ class CommandLineInterface(object): if options.list_locales: identifiers = localedata.list() longest = max([len(identifier) for identifier in identifiers]) + identifiers.sort() format = u'%%-%ds %%s' % (longest + 1) - for identifier in sorted(localedata.list()): + for identifier in identifiers: locale = Locale.parse(identifier) output = format % (identifier, locale.english_name) print output.encode(sys.stdout.encoding or