Opened 17 years ago

Closed 17 years ago

#4143 closed (fixed)

Icelandic postalcodes, id numbers and phone numbers for localflavor

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

Description

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 by django@…, 17 years ago

I couldn't add the attachment, it crashed everytime, so the localflavor files can be found at http://einaregilsson.com/downloads/is.zip

comment:2 by Simon G. <dev@…>, 17 years ago

Has patch: set
Needs tests: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

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,
Simon

comment:3 by django@…, 17 years ago

I´ve added tests to localflavor.py and fixed a small bug in ISIdNumberField. The new stuff is again at http://einaregilsson.com/downloads/is.zip , it contains the is_ folder and a diff file for localflavor.py.

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 by Malcolm Tredinnick, 17 years ago

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 by Malcolm Tredinnick, 17 years ago

Resolution: fixed
Status: newclosed

(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
django@….

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