[Python-modules-commits] r19162 - in packages/django-countries/trunk/debian/patches (1 file)

fladi-guest at users.alioth.debian.org fladi-guest at users.alioth.debian.org
Wed Nov 2 19:50:28 UTC 2011


    Date: Wednesday, November 2, 2011 @ 19:50:27
  Author: fladi-guest
Revision: 19162

Populate COUNTRIES_PLUS with missing duplicates.

Modified:
  packages/django-countries/trunk/debian/patches/use_iso_codes_package.patch

Modified: packages/django-countries/trunk/debian/patches/use_iso_codes_package.patch
===================================================================
--- packages/django-countries/trunk/debian/patches/use_iso_codes_package.patch	2011-11-02 19:34:23 UTC (rev 19161)
+++ packages/django-countries/trunk/debian/patches/use_iso_codes_package.patch	2011-11-02 19:50:27 UTC (rev 19162)
@@ -28,15 +28,13 @@
 +ISO_XML = _build_iso_xml()
 --- a/django_countries/countries.py
 +++ b/django_countries/countries.py
-@@ -1,5 +1,30 @@
+@@ -1,5 +1,31 @@
  from django.utils.translation import ugettext_lazy as _
  
 +from xml.dom.minidom import parse
-+import locale
 +
 +from django_countries import settings
 +
-+locale.setlocale(locale.LC_ALL, '')
 +
 +# Nicely titled (and translated) country names.
 +COUNTRIES = []
@@ -44,14 +42,17 @@
 +OFFICIAL_COUNTRIES = {}
 +
 +for node in sorted(parse(settings.ISO_XML).getElementsByTagName('iso_3166_entry'),
-+                   key=lambda node: node.getAttribute('name'),
-+                   cmp=locale.strcoll):
++                   key=lambda node: node.getAttribute('name')):
 +    _code = node.getAttribute('alpha_2_code')
 +    _name = _(node.getAttribute('name'))
 +    COUNTRIES.append((_code, _name))
 +    COUNTRIES_PLUS.append((_code, _name))
++    if _name.find(', ') >= 0:
++        COUNTRIES_PLUS.append((_code, ' '.join(reversed(_name.split(', ')))))
 +    OFFICIAL_COUNTRIES[_code.upper()] = _name.upper()
 +
++COUNTRIES_PLUS = sorted(COUNTRIES_PLUS, key=lambda node: node[1])
++
 +'''
 +# Upstream shipped static lists of countries.
 +from django.utils.translation import ugettext_lazy as _
@@ -59,7 +60,7 @@
  # Nicely titled (and translatable) country names.
  COUNTRIES = (
      ('AF', _(u'Afghanistan')),
-@@ -775,3 +800,5 @@
+@@ -775,3 +801,5 @@
      'ZM': u'ZAMBIA',
      'ZW': u'ZIMBABWE',
  }




More information about the Python-modules-commits mailing list