Changeset cef780 in indico
- Timestamp:
- 03/23/11 17:29:21 (2 years ago)
- 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
- File:
-
- 1 edited
-
indico/MaKaC/webinterface/common/countries.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
indico/MaKaC/webinterface/common/countries.py
r329651 rcef780 19 19 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20 20 21 from MaKaC.i18n import _ 22 23 class CountryHolder: 21 22 class 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 } 24 31 25 32 _countries = {} … … 218 225 _countries['US'] = "UNITED STATES OF AMERICA" 219 226 _countries['UY'] = "URUGUAY" 220 _countries['SU'] = "USSR"221 227 _countries['UZ'] = "UZBEKISTAN" 222 228 _countries['VA'] = "VATICAN CITY STATE" … … 231 237 @classmethod 232 238 def getCountries(cls): 239 """ 240 Return the whole country dictionary 241 """ 233 242 return cls._countries 234 243 235 244 @classmethod 236 245 def getCountryList( cls ): 246 """ 247 Returns all country names 248 """ 237 249 return cls._countries.values() 238 250 239 251 @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)) 242 258 243 259 @classmethod 244 260 def getCountryKeys(cls): 261 """ 262 Returns all country ids 263 """ 245 264 return cls._countries.keys() 246 265 247 266 @classmethod 248 267 def getCountrySortedKeys(cls): 268 """ 269 Country ids, sorted alphabetically by country name 270 """ 249 271 keys = cls.getCountryKeys() 250 272 keys.sort(cls._sortByValue) … … 253 275 @classmethod 254 276 def _sortByValue(cls, v1, v2): 277 """ 278 Auxiliar function for country id sorting 279 """ 255 280 return cmp(cls._countries[v1], cls._countries[v2])
Note: See TracChangeset
for help on using the changeset viewer.
