commit 9bbe112c08a0ad4dd30b1b59a5ff87a3d7ea69dc
Author: Claude Paroz <claude@2xlibre.net>
Date:   Sat Apr 30 21:51:09 2011 +0200

    Rename django.contrib.localflavor.uk to django.contrib.localflavor.gb

diff --git a/django/contrib/localflavor/gb/__init__.py b/django/contrib/localflavor/gb/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/django/contrib/localflavor/gb/forms.py b/django/contrib/localflavor/gb/forms.py
new file mode 100644
index 0000000..0f7d91a
--- /dev/null
+++ b/django/contrib/localflavor/gb/forms.py
@@ -0,0 +1,53 @@
+"""
+GB-specific Form helpers
+"""
+
+import re
+
+from django.forms.fields import CharField, Select
+from django.forms import ValidationError
+from django.utils.translation import ugettext_lazy as _
+
+class GBPostcodeField(CharField):
+    """
+    A form field that validates its input is a UK postcode.
+
+    The regular expression used is sourced from the schema for British Standard
+    BS7666 address types: http://www.govtalk.gov.uk/gdsc/schemas/bs7666-v2-0.xsd
+
+    The value is uppercased and a space added in the correct place, if required.
+    """
+    default_error_messages = {
+        'invalid': _(u'Enter a valid postcode.'),
+    }
+    outcode_pattern = '[A-PR-UWYZ]([0-9]{1,2}|([A-HIK-Y][0-9](|[0-9]|[ABEHMNPRVWXY]))|[0-9][A-HJKSTUW])'
+    incode_pattern = '[0-9][ABD-HJLNP-UW-Z]{2}'
+    postcode_regex = re.compile(r'^(GIR 0AA|%s %s)$' % (outcode_pattern, incode_pattern))
+    space_regex = re.compile(r' *(%s)$' % incode_pattern)
+
+    def clean(self, value):
+        value = super(GBPostcodeField, self).clean(value)
+        if value == u'':
+            return value
+        postcode = value.upper().strip()
+        # Put a single space before the incode (second part).
+        postcode = self.space_regex.sub(r' \1', postcode)
+        if not self.postcode_regex.search(postcode):
+            raise ValidationError(self.error_messages['invalid'])
+        return postcode
+
+class GBCountySelect(Select):
+    """
+    A Select widget that uses a list of UK Counties/Regions as its choices.
+    """
+    def __init__(self, attrs=None):
+        from gb_regions import GB_REGION_CHOICES
+        super(GBCountySelect, self).__init__(attrs, choices=GB_REGION_CHOICES)
+
+class GBNationSelect(Select):
+    """
+    A Select widget that uses a list of UK Nations as its choices.
+    """
+    def __init__(self, attrs=None):
+        from gb_regions import GB_NATIONS_CHOICES
+        super(GBNationSelect, self).__init__(attrs, choices=GB_NATIONS_CHOICES)
diff --git a/django/contrib/localflavor/gb/gb_regions.py b/django/contrib/localflavor/gb/gb_regions.py
new file mode 100644
index 0000000..c5f5dd7
--- /dev/null
+++ b/django/contrib/localflavor/gb/gb_regions.py
@@ -0,0 +1,97 @@
+"""
+Sources:
+    English regions: http://www.statistics.gov.uk/geography/downloads/31_10_01_REGION_names_and_codes_12_00.xls
+    Northern Ireland regions: http://en.wikipedia.org/wiki/List_of_Irish_counties_by_area
+    Welsh regions: http://en.wikipedia.org/wiki/Preserved_counties_of_Wales
+    Scottish regions: http://en.wikipedia.org/wiki/Regions_and_districts_of_Scotland
+"""
+from django.utils.translation import ugettext_lazy as _
+
+ENGLAND_REGION_CHOICES = (
+    ("Bedfordshire", _("Bedfordshire")),
+    ("Buckinghamshire", _("Buckinghamshire")),
+    ("Cambridgeshire", ("Cambridgeshire")),
+    ("Cheshire", _("Cheshire")),
+    ("Cornwall and Isles of Scilly", _("Cornwall and Isles of Scilly")),
+    ("Cumbria", _("Cumbria")),
+    ("Derbyshire", _("Derbyshire")),
+    ("Devon", _("Devon")),
+    ("Dorset", _("Dorset")),
+    ("Durham", _("Durham")),
+    ("East Sussex", _("East Sussex")),
+    ("Essex", _("Essex")),
+    ("Gloucestershire", _("Gloucestershire")),
+    ("Greater London", _("Greater London")),
+    ("Greater Manchester", _("Greater Manchester")),
+    ("Hampshire", _("Hampshire")),
+    ("Hertfordshire", _("Hertfordshire")),
+    ("Kent", _("Kent")),
+    ("Lancashire", _("Lancashire")),
+    ("Leicestershire", _("Leicestershire")),
+    ("Lincolnshire", _("Lincolnshire")),
+    ("Merseyside", _("Merseyside")),
+    ("Norfolk", _("Norfolk")),
+    ("North Yorkshire", _("North Yorkshire")),
+    ("Northamptonshire", _("Northamptonshire")),
+    ("Northumberland", _("Northumberland")),
+    ("Nottinghamshire", _("Nottinghamshire")),
+    ("Oxfordshire", _("Oxfordshire")),
+    ("Shropshire", _("Shropshire")),
+    ("Somerset", _("Somerset")),
+    ("South Yorkshire", _("South Yorkshire")),
+    ("Staffordshire", _("Staffordshire")),
+    ("Suffolk", _("Suffolk")),
+    ("Surrey", _("Surrey")),
+    ("Tyne and Wear", _("Tyne and Wear")),
+    ("Warwickshire", _("Warwickshire")),
+    ("West Midlands", _("West Midlands")),
+    ("West Sussex", _("West Sussex")),
+    ("West Yorkshire", _("West Yorkshire")),
+    ("Wiltshire", _("Wiltshire")),
+    ("Worcestershire", _("Worcestershire")),
+)
+
+NORTHERN_IRELAND_REGION_CHOICES = (
+    ("County Antrim", _("County Antrim")),
+    ("County Armagh", _("County Armagh")),
+    ("County Down", _("County Down")),
+    ("County Fermanagh", _("County Fermanagh")),
+    ("County Londonderry", _("County Londonderry")),
+    ("County Tyrone", _("County Tyrone")),
+)
+
+WALES_REGION_CHOICES = (
+    ("Clwyd", _("Clwyd")),
+    ("Dyfed", _("Dyfed")),
+    ("Gwent", _("Gwent")),
+    ("Gwynedd", _("Gwynedd")),
+    ("Mid Glamorgan", _("Mid Glamorgan")),
+    ("Powys", _("Powys")),
+    ("South Glamorgan", _("South Glamorgan")),
+    ("West Glamorgan", _("West Glamorgan")),
+)
+
+SCOTTISH_REGION_CHOICES = (
+    ("Borders", _("Borders")),
+    ("Central Scotland", _("Central Scotland")),
+    ("Dumfries and Galloway", _("Dumfries and Galloway")),
+    ("Fife", _("Fife")),
+    ("Grampian", _("Grampian")),
+    ("Highland", _("Highland")),
+    ("Lothian", _("Lothian")),
+    ("Orkney Islands", _("Orkney Islands")),
+    ("Shetland Islands", _("Shetland Islands")),
+    ("Strathclyde", _("Strathclyde")),
+    ("Tayside", _("Tayside")),
+    ("Western Isles", _("Western Isles")),
+)
+
+GB_NATIONS_CHOICES = (
+    ("England", _("England")),
+    ("Northern Ireland", _("Northern Ireland")),
+    ("Scotland", _("Scotland")),
+    ("Wales", _("Wales")),
+)
+
+GB_REGION_CHOICES = ENGLAND_REGION_CHOICES + NORTHERN_IRELAND_REGION_CHOICES + WALES_REGION_CHOICES + SCOTTISH_REGION_CHOICES
+
diff --git a/django/contrib/localflavor/uk/forms.py b/django/contrib/localflavor/uk/forms.py
index aafe973..c54058c 100644
--- a/django/contrib/localflavor/uk/forms.py
+++ b/django/contrib/localflavor/uk/forms.py
@@ -1,53 +1,11 @@
-"""
-UK-specific Form helpers
-"""
+from django.contrib.localflavor.gb import forms
 
-import re
+import warnings
+warnings.warn(
+    'UK prefix for United Kingdom has been deprecated in favour of the GB code. Please use the new GB-prefixed names.',
+    PendingDeprecationWarning
+)
 
-from django.forms.fields import CharField, Select
-from django.forms import ValidationError
-from django.utils.translation import ugettext_lazy as _
-
-class UKPostcodeField(CharField):
-    """
-    A form field that validates its input is a UK postcode.
-
-    The regular expression used is sourced from the schema for British Standard
-    BS7666 address types: http://www.govtalk.gov.uk/gdsc/schemas/bs7666-v2-0.xsd
-
-    The value is uppercased and a space added in the correct place, if required.
-    """
-    default_error_messages = {
-        'invalid': _(u'Enter a valid postcode.'),
-    }
-    outcode_pattern = '[A-PR-UWYZ]([0-9]{1,2}|([A-HIK-Y][0-9](|[0-9]|[ABEHMNPRVWXY]))|[0-9][A-HJKSTUW])'
-    incode_pattern = '[0-9][ABD-HJLNP-UW-Z]{2}'
-    postcode_regex = re.compile(r'^(GIR 0AA|%s %s)$' % (outcode_pattern, incode_pattern))
-    space_regex = re.compile(r' *(%s)$' % incode_pattern)
-
-    def clean(self, value):
-        value = super(UKPostcodeField, self).clean(value)
-        if value == u'':
-            return value
-        postcode = value.upper().strip()
-        # Put a single space before the incode (second part).
-        postcode = self.space_regex.sub(r' \1', postcode)
-        if not self.postcode_regex.search(postcode):
-            raise ValidationError(self.error_messages['invalid'])
-        return postcode
-
-class UKCountySelect(Select):
-    """
-    A Select widget that uses a list of UK Counties/Regions as its choices.
-    """
-    def __init__(self, attrs=None):
-        from uk_regions import UK_REGION_CHOICES
-        super(UKCountySelect, self).__init__(attrs, choices=UK_REGION_CHOICES)
-
-class UKNationSelect(Select):
-    """
-    A Select widget that uses a list of UK Nations as its choices.
-    """
-    def __init__(self, attrs=None):
-        from uk_regions import UK_NATIONS_CHOICES
-        super(UKNationSelect, self).__init__(attrs, choices=UK_NATIONS_CHOICES)
+UKPostcodeField = forms.GBPostcodeField
+UKCountySelect = forms.GBCountySelect
+UKNationSelect = forms.GBNationSelect
diff --git a/django/contrib/localflavor/uk/uk_regions.py b/django/contrib/localflavor/uk/uk_regions.py
index dd92f5e..71fabc0 100644
--- a/django/contrib/localflavor/uk/uk_regions.py
+++ b/django/contrib/localflavor/uk/uk_regions.py
@@ -1,97 +1,10 @@
-"""
-Sources:
-    English regions: http://www.statistics.gov.uk/geography/downloads/31_10_01_REGION_names_and_codes_12_00.xls
-    Northern Ireland regions: http://en.wikipedia.org/wiki/List_of_Irish_counties_by_area
-    Welsh regions: http://en.wikipedia.org/wiki/Preserved_counties_of_Wales
-    Scottish regions: http://en.wikipedia.org/wiki/Regions_and_districts_of_Scotland
-"""
-from django.utils.translation import ugettext_lazy as _
+from django.contrib.localflavor.gb.gb_regions import *
 
-ENGLAND_REGION_CHOICES = (
-    ("Bedfordshire", _("Bedfordshire")),
-    ("Buckinghamshire", _("Buckinghamshire")),
-    ("Cambridgeshire", ("Cambridgeshire")),
-    ("Cheshire", _("Cheshire")),
-    ("Cornwall and Isles of Scilly", _("Cornwall and Isles of Scilly")),
-    ("Cumbria", _("Cumbria")),
-    ("Derbyshire", _("Derbyshire")),
-    ("Devon", _("Devon")),
-    ("Dorset", _("Dorset")),
-    ("Durham", _("Durham")),
-    ("East Sussex", _("East Sussex")),
-    ("Essex", _("Essex")),
-    ("Gloucestershire", _("Gloucestershire")),
-    ("Greater London", _("Greater London")),
-    ("Greater Manchester", _("Greater Manchester")),
-    ("Hampshire", _("Hampshire")),
-    ("Hertfordshire", _("Hertfordshire")),
-    ("Kent", _("Kent")),
-    ("Lancashire", _("Lancashire")),
-    ("Leicestershire", _("Leicestershire")),
-    ("Lincolnshire", _("Lincolnshire")),
-    ("Merseyside", _("Merseyside")),
-    ("Norfolk", _("Norfolk")),
-    ("North Yorkshire", _("North Yorkshire")),
-    ("Northamptonshire", _("Northamptonshire")),
-    ("Northumberland", _("Northumberland")),
-    ("Nottinghamshire", _("Nottinghamshire")),
-    ("Oxfordshire", _("Oxfordshire")),
-    ("Shropshire", _("Shropshire")),
-    ("Somerset", _("Somerset")),
-    ("South Yorkshire", _("South Yorkshire")),
-    ("Staffordshire", _("Staffordshire")),
-    ("Suffolk", _("Suffolk")),
-    ("Surrey", _("Surrey")),
-    ("Tyne and Wear", _("Tyne and Wear")),
-    ("Warwickshire", _("Warwickshire")),
-    ("West Midlands", _("West Midlands")),
-    ("West Sussex", _("West Sussex")),
-    ("West Yorkshire", _("West Yorkshire")),
-    ("Wiltshire", _("Wiltshire")),
-    ("Worcestershire", _("Worcestershire")),
+import warnings
+warnings.warn(
+    'UK prefix for United Kingdom has been deprecated in favour of the GB code. Please use the new GB-prefixed names.',
+    PendingDeprecationWarning
 )
 
-NORTHERN_IRELAND_REGION_CHOICES = (
-    ("County Antrim", _("County Antrim")),
-    ("County Armagh", _("County Armagh")),
-    ("County Down", _("County Down")),
-    ("County Fermanagh", _("County Fermanagh")),
-    ("County Londonderry", _("County Londonderry")),
-    ("County Tyrone", _("County Tyrone")),
-)
-
-WALES_REGION_CHOICES = (
-    ("Clwyd", _("Clwyd")),
-    ("Dyfed", _("Dyfed")),
-    ("Gwent", _("Gwent")),
-    ("Gwynedd", _("Gwynedd")),
-    ("Mid Glamorgan", _("Mid Glamorgan")),
-    ("Powys", _("Powys")),
-    ("South Glamorgan", _("South Glamorgan")),
-    ("West Glamorgan", _("West Glamorgan")),
-)
-
-SCOTTISH_REGION_CHOICES = (
-    ("Borders", _("Borders")),
-    ("Central Scotland", _("Central Scotland")),
-    ("Dumfries and Galloway", _("Dumfries and Galloway")),
-    ("Fife", _("Fife")),
-    ("Grampian", _("Grampian")),
-    ("Highland", _("Highland")),
-    ("Lothian", _("Lothian")),
-    ("Orkney Islands", _("Orkney Islands")),
-    ("Shetland Islands", _("Shetland Islands")),
-    ("Strathclyde", _("Strathclyde")),
-    ("Tayside", _("Tayside")),
-    ("Western Isles", _("Western Isles")),
-)
-
-UK_NATIONS_CHOICES = (
-    ("England", _("England")),
-    ("Northern Ireland", _("Northern Ireland")),
-    ("Scotland", _("Scotland")),
-    ("Wales", _("Wales")),
-)
-
-UK_REGION_CHOICES = ENGLAND_REGION_CHOICES + NORTHERN_IRELAND_REGION_CHOICES + WALES_REGION_CHOICES + SCOTTISH_REGION_CHOICES
-
+UK_NATIONS_CHOICES = GB_NATIONS_CHOICES
+UK_REGION_CHOICES  = GB_REGION_CHOICES
diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt
index a38823f..98b2138 100644
--- a/docs/internals/deprecation.txt
+++ b/docs/internals/deprecation.txt
@@ -175,7 +175,6 @@ their deprecation, as per the :ref:`Django deprecation policy
           combine paths in templates.
 
     * 1.6
-
         * The compatibility modules ``django.utils.copycompat`` and
           ``django.utils.hashcompat`` as well as the functions
           ``django.utils.itercompat.all`` and ``django.utils.itercompat.any``
@@ -195,6 +194,11 @@ their deprecation, as per the :ref:`Django deprecation policy
           is now an alias for :class:`~django.core.cache.backends.memcached.MemcachedCache`.
           In Django 1.6, the historical alias will be removed.
 
+        * The UK-prefixed objects of ``django.contrib.localflavor.uk`` will only
+          be accessible through their new GB-prefixed names (GB is the correct
+          ISO 3166 code for United Kingdom). They have been depreacted since the
+          1.4 release.
+
     * 2.0
         * ``django.views.defaults.shortcut()``. This function has been moved
           to ``django.contrib.contenttypes.views.shortcut()`` as part of the
diff --git a/docs/ref/contrib/localflavor.txt b/docs/ref/contrib/localflavor.txt
index 4935382..f6dab64 100644
--- a/docs/ref/contrib/localflavor.txt
+++ b/docs/ref/contrib/localflavor.txt
@@ -123,7 +123,7 @@ Here's an example of how to use them::
 .. _Sweden: `Sweden (se)`_
 .. _Switzerland: `Switzerland (ch)`_
 .. _Turkey: `Turkey (tr)`_
-.. _United Kingdom: `United Kingdom (uk)`_
+.. _United Kingdom: `United Kingdom (gb)`_
 .. _United States of America: `United States of America (us)`_
 .. _Uruguay: `Uruguay (uy)`_
 
@@ -1054,20 +1054,20 @@ Turkey (``tr``)
 
     A ``select`` widget that uses a list of Turkish provinces as its choices.
 
-United Kingdom (``uk``)
+United Kingdom (``gb``)
 =======================
 
-.. class:: uk.forms.UKPostcodeField
+.. class:: gb.forms.GBPostcodeField
 
     A form field that validates input as a UK postcode. The regular
     expression used is sourced from the schema for British Standard BS7666
     address types at http://www.cabinetoffice.gov.uk/media/291293/bs7666-v2-0.xml.
 
-.. class:: uk.forms.UKCountySelect
+.. class:: gb.forms.GBCountySelect
 
     A ``Select`` widget that uses a list of UK counties/regions as its choices.
 
-.. class:: uk.forms.UKNationSelect
+.. class:: gb.forms.GBNationSelect
 
     A ``Select`` widget that uses a list of UK nations as its choices.
 
diff --git a/tests/regressiontests/forms/localflavor/gb.py b/tests/regressiontests/forms/localflavor/gb.py
new file mode 100644
index 0000000..7f23ba5
--- /dev/null
+++ b/tests/regressiontests/forms/localflavor/gb.py
@@ -0,0 +1,30 @@
+from django.contrib.localflavor.gb.forms import GBPostcodeField
+
+from utils import LocalFlavorTestCase
+
+
+class GBLocalFlavorTests(LocalFlavorTestCase):
+    def test_GBPostcodeField(self):
+        error_invalid = [u'Enter a valid postcode.']
+        valid = {
+            'BT32 4PX': 'BT32 4PX',
+            'GIR 0AA': 'GIR 0AA',
+            'BT324PX': 'BT32 4PX',
+            ' so11aa ': 'SO1 1AA',
+            ' so1  1aa ': 'SO1 1AA',
+            'G2 3wt': 'G2 3WT',
+            'EC1A 1BB': 'EC1A 1BB',
+            'Ec1a1BB': 'EC1A 1BB',
+        }
+        invalid = {
+            '1NV 4L1D': error_invalid,
+            '1NV4L1D': error_invalid,
+            ' b0gUS': error_invalid,
+        }
+        self.assertFieldOutput(GBPostcodeField, valid, invalid)
+        valid = {}
+        invalid = {
+            '1NV 4L1D': [u'Enter a bloody postcode!'],
+        }
+        kwargs = {'error_messages': {'invalid': 'Enter a bloody postcode!'}}
+        self.assertFieldOutput(GBPostcodeField, valid, invalid, field_kwargs=kwargs)
diff --git a/tests/regressiontests/forms/localflavor/uk.py b/tests/regressiontests/forms/localflavor/uk.py
deleted file mode 100644
index 6fd536f..0000000
--- a/tests/regressiontests/forms/localflavor/uk.py
+++ /dev/null
@@ -1,30 +0,0 @@
-from django.contrib.localflavor.uk.forms import UKPostcodeField
-
-from utils import LocalFlavorTestCase
-
-
-class UKLocalFlavorTests(LocalFlavorTestCase):
-    def test_UKPostcodeField(self):
-        error_invalid = [u'Enter a valid postcode.']
-        valid = {
-            'BT32 4PX': 'BT32 4PX',
-            'GIR 0AA': 'GIR 0AA',
-            'BT324PX': 'BT32 4PX',
-            ' so11aa ': 'SO1 1AA',
-            ' so1  1aa ': 'SO1 1AA',
-            'G2 3wt': 'G2 3WT',
-            'EC1A 1BB': 'EC1A 1BB',
-            'Ec1a1BB': 'EC1A 1BB',
-        }
-        invalid = {
-            '1NV 4L1D': error_invalid,
-            '1NV4L1D': error_invalid,
-            ' b0gUS': error_invalid,
-        }
-        self.assertFieldOutput(UKPostcodeField, valid, invalid)
-        valid = {}
-        invalid = {
-            '1NV 4L1D': [u'Enter a bloody postcode!'],
-        }
-        kwargs = {'error_messages': {'invalid': 'Enter a bloody postcode!'}}
-        self.assertFieldOutput(UKPostcodeField, valid, invalid, field_kwargs=kwargs)
diff --git a/tests/regressiontests/forms/localflavortests.py b/tests/regressiontests/forms/localflavortests.py
index 73f46a7..fb501ab 100644
--- a/tests/regressiontests/forms/localflavortests.py
+++ b/tests/regressiontests/forms/localflavortests.py
@@ -12,6 +12,7 @@ from localflavor.de import DELocalFlavorTests
 from localflavor.es import ESLocalFlavorTests
 from localflavor.fi import FILocalFlavorTests
 from localflavor.fr import FRLocalFlavorTests
+from localflavor.gb import GBLocalFlavorTests
 from localflavor.generic import GenericLocalFlavorTests
 from localflavor.hr import HRLocalFlavorTests
 from localflavor.id import IDLocalFlavorTests
@@ -29,7 +30,6 @@ from localflavor.ru import RULocalFlavorTests
 from localflavor.se import SELocalFlavorTests
 from localflavor.sk import SKLocalFlavorTests
 from localflavor.tr import TRLocalFlavorTests
-from localflavor.uk import UKLocalFlavorTests
 from localflavor.us import USLocalFlavorTests
 from localflavor.uy import UYLocalFlavorTests
 from localflavor.za import ZALocalFlavorTests
diff --git a/tests/regressiontests/forms/tests/__init__.py b/tests/regressiontests/forms/tests/__init__.py
index 2d8f9e9..6366a93 100644
--- a/tests/regressiontests/forms/tests/__init__.py
+++ b/tests/regressiontests/forms/tests/__init__.py
@@ -26,6 +26,7 @@ from regressiontests.forms.localflavortests import (
     ESLocalFlavorTests,
     FILocalFlavorTests,
     FRLocalFlavorTests,
+    GBLocalFlavorTests,
     GenericLocalFlavorTests,
     HRLocalFlavorTests,
     IDLocalFlavorTests,
@@ -43,7 +44,6 @@ from regressiontests.forms.localflavortests import (
     SELocalFlavorTests,
     SKLocalFlavorTests,
     TRLocalFlavorTests,
-    UKLocalFlavorTests,
     USLocalFlavorTests,
     UYLocalFlavorTests,
     ZALocalFlavorTests
