Changeset cef780 in indico


Ignore:
Timestamp:
03/23/11 17:29:21 (2 years ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, d9941f8582b36b24821a11ea5ba16fda6a457fb1
Children:
986f31
Parents:
655cb4
Message:

[FIX] Removed 'USSR' from countries

  • In Soviet Russia country removes you;
  • Created list of old countries;
  • Added doctstrings;
File:
1 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/webinterface/common/countries.py

    r329651 rcef780  
    1919## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 
    2020 
    21 from MaKaC.i18n import _ 
    22  
    23 class CountryHolder: 
     21 
     22class CountryHolder(object): 
     23    """ 
     24    Contains all countries in the world 
     25    """ 
     26 
     27    # old countries that no longer exist 
     28    _oldCountries = { 
     29        'SU': "USSR" 
     30        } 
    2431 
    2532    _countries = {} 
     
    218225    _countries['US'] = "UNITED STATES OF AMERICA" 
    219226    _countries['UY'] = "URUGUAY" 
    220     _countries['SU'] = "USSR" 
    221227    _countries['UZ'] = "UZBEKISTAN" 
    222228    _countries['VA'] = "VATICAN CITY STATE" 
     
    231237    @classmethod 
    232238    def getCountries(cls): 
     239        """ 
     240        Return the whole country dictionary 
     241        """ 
    233242        return cls._countries 
    234243 
    235244    @classmethod 
    236245    def getCountryList( cls ): 
     246        """ 
     247        Returns all country names 
     248        """ 
    237249        return cls._countries.values() 
    238250 
    239251    @classmethod 
    240     def getCountryById( cls, id ): 
    241         return cls._countries.get(id, "") 
     252    def getCountryById( cls, cid ): 
     253        """ 
     254        Returns the country, given its ID 
     255        """ 
     256        return cls._countries.get(cid, 
     257                                  cls._oldCountries.get(cid, cid)) 
    242258 
    243259    @classmethod 
    244260    def getCountryKeys(cls): 
     261        """ 
     262        Returns all country ids 
     263        """ 
    245264        return cls._countries.keys() 
    246265 
    247266    @classmethod 
    248267    def getCountrySortedKeys(cls): 
     268        """ 
     269        Country ids, sorted alphabetically by country name 
     270        """ 
    249271        keys = cls.getCountryKeys() 
    250272        keys.sort(cls._sortByValue) 
     
    253275    @classmethod 
    254276    def _sortByValue(cls, v1, v2): 
     277        """ 
     278        Auxiliar function for country id sorting 
     279        """ 
    255280        return cmp(cls._countries[v1], cls._countries[v2]) 
Note: See TracChangeset for help on using the changeset viewer.