Opened 5 years ago

Closed 4 years ago

#13729 closed Bug (fixed)

UK localflavor mis-named/documentation bug.

Reported by: 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:

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 schinckel 5 years ago.
13729-with-deprecation-path.diff (19.6 KB) - added by claudep 4 years ago.

Download all attachments as: .zip

Change History (12)

Changed 5 years ago by schinckel

comment:1 Changed 5 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 4 years ago by frasern

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 Changed 4 years ago by julien

  • Component changed from Contrib apps to django.contrib.localflavor

comment:4 Changed 4 years ago by julien

  • Severity set to Normal
  • Type set to Bug

comment:5 Changed 4 years ago by claudep

  • 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 Changed 4 years ago by claudep

  • Has patch set
  • Patch needs improvement unset

Changed 4 years ago by claudep

comment:7 Changed 4 years ago by jezdez

  • Triage Stage changed from Accepted to Ready for checkin

comment:8 Changed 4 years ago by anonymous

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 Changed 4 years ago by claudep

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 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

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