Opened 9 years ago

Closed 9 years ago

#4143 closed (fixed)

Icelandic postalcodes, id numbers and phone numbers for localflavor

Reported by: django@… Owned by: adrian
Component: contrib.localflavor Version: master
Severity: Keywords: iceland localflavor
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:


This zip includes Icelandic postalcodes, id numbers and phone numbers for contrib.localflavor. For some reason TortoiseSVN didn't allow me to make a patch from the folder, don't know why. The folder is named is_ because python complains if it's called 'is', which is the country code for iceland.

Change History (5)

comment:1 Changed 9 years ago by django@…

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

I couldn't add the attachment, it crashed everytime, so the localflavor files can be found at

comment:2 Changed 9 years ago by Simon G. <dev@…>

  • Has patch set
  • Needs tests set
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

This looks good, just a few requests (please!):

+ Can you mark the postcode strings as unicode i.e.:

+    ('101', u'101 Reykjavík'),
+    ('103', u'103 Reykjavík'),
+    ('104', u'104 Reykjavík'),

+ provide some tests for ISIdNumberField, ISPhoneNumberField, and ISPostalCodeSelect (these help us not break things by mistake, and are really important for i18n/l10n stuff like this).

Many thanks,

comment:3 Changed 9 years ago by django@…

I´ve added tests to and fixed a small bug in ISIdNumberField. The new stuff is again at , it contains the is_ folder and a diff file for

One thing though, the test for ISPostalCodeSelect fails with the following error message: 'UnicodeDecodeError: 'ascii' codec can't decode byte 0xed in position 51: ordinal not in range(128)'

When I was writing the test in the shell then it was printed to the screen without problems (obviously, as I copied the output to the test), but when I run the test I get this error. I´m not sure if it's because of some settings I have or if it would happen everywhere. I didn't see any other local flavors with non ascii characters, is this a known problem?

Any ideas on this?

comment:4 Changed 9 years ago by mtredinnick

  • Needs tests unset

Regarding the error you're seeing, this is because you're screen is able to display UTF-8 sstrings, whereas the doctest framework tries to do plain string comparisons. The fix is to display the repr() of the result so that the UTF-8 string can be compared byte-for-byte.

I'll look at this patch later tonight and fix up the tests when I commit it (if there aren't any other obvious problems).

comment:5 Changed 9 years ago by mtredinnick

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

(In [5080]) Fixed #4143 -- Added Icelandic localflavor. Note that we use the is_/ directory
name because "is" is a reserved word in Python. Patch from

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