Mercurial > babel > old > mirror
changeset 442:fa1625bcbe47
remove sorted and don't assume dict ordering (Python 2.3 & Jython compat)
author | pjenvey |
---|---|
date | Fri, 25 Sep 2009 20:29:11 +0000 |
parents | 9549bb80a5a7 |
children | d2e9aaa7c91c |
files | babel/localedata.py babel/messages/frontend.py |
diffstat | 2 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/babel/localedata.py +++ b/babel/localedata.py @@ -120,8 +120,8 @@ >>> 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
--- a/babel/messages/frontend.py +++ b/babel/messages/frontend.py @@ -638,8 +638,9 @@ 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