Changeset 7870 for main


Ignore:
Timestamp:
13 Mar 2012, 08:52:21 (13 years ago)
Author:
Henrik Bettermann
Message:

Define sorting order of country codes in select boxes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/widgets/phonewidget.py

    r7856 r7870  
    3333
    3434INT_PHONE_PREFIXES = {
    35         _('Germany'): '49',
    36         _('Nigeria'): '234',
    37         _('U.S.'): '1',
     35        _('Germany'): (2, '49'),
     36        _('Nigeria'): (1, '234'),
     37        _('U.S.'): (3, '1'),
    3838        }
    3939
     
    4141    grok.implements(IInternationalPhonePrefixes)
    4242
    43     _data = INT_PHONE_PREFIXES.items()
     43    _data = sorted(INT_PHONE_PREFIXES.items(), key=lambda value: value[1][0])
    4444
    4545    def title_value_list(self):
    46         return sorted([('%s (+%s)' % (x,y), '+%s' % y)
    47                        for x,y in self._data])
     46        return [('%s (+%s)' % (x,y[1]), '+%s' % y[1]) for x,y in self._data]
    4847
    4948RE_INT_PREFIX = re.compile('^\+\d+')
Note: See TracChangeset for help on using the changeset viewer.