Django

Code

Ticket #4143 (closed: fixed)

Opened 2 years ago

Last modified 2 years ago

Icelandic postalcodes, id numbers and phone numbers for localflavor

Reported by: django@einaregilsson.com Assigned to: adrian
Milestone: Component: django.contrib.localflavor
Version: SVN Keywords: iceland localflavor
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 1

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.

Attachments

Change History

04/24/07 10:52:10 changed by django@einaregilsson.com

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

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

04/25/07 06:22:45 changed by Simon G. <dev@simon.net.nz>

  • needs_better_patch set to 1.
  • has_patch set to 1.
  • needs_tests set to 1.
  • 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, Simon

04/25/07 17:47:25 changed by django@einaregilsson.com

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?

04/26/07 01:46:14 changed by mtredinnick

  • needs_tests deleted.

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).

04/26/07 03:43:25 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(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@einaregilsson.com.


Add/Change #4143 (Icelandic postalcodes, id numbers and phone numbers for localflavor)




Change Properties
Action