Opened 14 years ago

Closed 14 years ago

#13729 closed Bug (fixed)

UK localflavor mis-named/documentation bug.

Reported by: Matthew Schinckel Owned by: nobody
Component: contrib.localflavor Version: 1.2
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The documentation for localflavor states that:

Inside that package, country- or culture-specific code is organized into subpackages, named using ISO 3166 country codes.

However, the ISO 3166 code for the United Kingdom is actually GB. Thus, anything that uses ISO 3166 codes to store countries (such as django-countries) will be unable to automatically get the correct localflavor information.

Since changing this would break existing code, perhaps there could be another gb module that just shadows the uk module.

For instance, in gb/forms.py, we might have:

from django.contrib.localflavor import uk
GBPostcodeField = uk.UKPostcodeField
GBCountySelect = uk.UKCountySelect
GBNationSelect = uk.UKNationSelect

This means that all is needed is this file, and any changes to the uk one will also apply to gb.

Attachments (2)

gb-localflavor.diff (604 bytes ) - added by Matthew Schinckel 14 years ago.
13729-with-deprecation-path.diff (19.6 KB ) - added by Claude Paroz 14 years ago.

Download all attachments as: .zip

Change History (12)

by Matthew Schinckel, 14 years ago

Attachment: gb-localflavor.diff added

comment:1 by Russell Keith-Magee, 14 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Fraser Nevett, 14 years ago

I raised this issue previously in #8323. As this ticket has been accepted and has a proposed patch, I closed the older ticket in favour of this one.

comment:3 by Julien Phalip, 14 years ago

Component: Contrib appsdjango.contrib.localflavor

comment:4 by Julien Phalip, 14 years ago

Severity: Normal
Type: Bug

comment:5 by Claude Paroz, 14 years ago

Easy pickings: unset
Patch needs improvement: set

We cannot leave the uk directory occupied by the gb content, because uk is the code for Ukrain. So we have to move files and follow a deprecation path in the current uk directory.

comment:6 by Claude Paroz, 14 years ago

Has patch: set
Patch needs improvement: unset

by Claude Paroz, 14 years ago

comment:7 by Jannis Leidel, 14 years ago

Triage Stage: AcceptedReady for checkin

comment:8 by anonymous, 14 years ago

Just to correct comment 5, UA is the code for Ukraine. UK is "exceptionally reserved" for the United Kingdom (see http://www.iso.org/iso/iso-3166-1_decoding_table#UK).

comment:9 by Claude Paroz, 14 years ago

Thanks for the correction, I mixed up uk ISO 639-1 for Ukrainian language and UA the ISO 3166 country code for Ukraine. It is not referenced in the patch, though.

comment:10 by Jannis Leidel, 14 years ago

Resolution: fixed
Status: newclosed

In [16147]:

Fixed #13729 -- Renamed UK localflavor to GB to correctly follow ISO 3166. Thanks, Claude Paroz.

Note: See TracTickets for help on using tickets.
Back to Top