Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#3847 closed (fixed)

Add Finnish localflavor

Reported by: Ville Säävuori <Ville@…> Owned by: Adrian Holovaty
Component: Contrib apps Version: master
Severity: Keywords: localflavor, l10n, fi
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:

Description

Patch to add fi module to django.contrib.localflavor: FIZipCodeField and FIMunicipalitySelect.

Tests included.

Attachments (3)

fi_localflavor.diff (34.7 KB) - added by Ville Säävuori <Ville@…> 10 years ago.
fi_localflavor_unicode.diff (35.1 KB) - added by Ville Säävuori <Ville@…> 10 years ago.
A better patch (hopefully). This time with unicode strings.
fi_localflavor_social_security_number.patch (3.1 KB) - added by karsu 10 years ago.
A Finnish social security number field

Download all attachments as: .zip

Change History (16)

Changed 10 years ago by Ville Säävuori <Ville@…>

Attachment: fi_localflavor.diff added

comment:1 Changed 10 years ago by Simon G. <dev@…>

Triage Stage: UnreviewedReady for checkin

comment:2 Changed 10 years ago by Malcolm Tredinnick

Patch needs improvement: set

I would prefer that the second argument in each tuple was marked as a Unicode string (u"..."). The problem with the current method is that Python will convert the second argument to a str object, rather than a unicode object. However, it doesn't attach any information to that object to indicate that it is UTF-8 encoded (rather than some other encoding or just a string of bytes). This can cause problems as the objects become further and further removed from their creation point. Further, you cannot use encode() or decode() on them in their current form (Python fails on ordinal values greater than 127, which happen frequently in UTF-8 strings from non-English locales).

To ease our transition to unicode internally and help avoid encoding problems, marking the strings as unicode objects is a better approach here.

comment:3 Changed 10 years ago by Malcolm Tredinnick

Triage Stage: Ready for checkinAccepted

comment:4 Changed 10 years ago by Ville Säävuori <Ville@…>

Thanks for your quick response and comments! I was a little bit uncertain about this, too. I'll modify the patch and add a better one ASAP.

Changed 10 years ago by Ville Säävuori <Ville@…>

Attachment: fi_localflavor_unicode.diff added

A better patch (hopefully). This time with unicode strings.

comment:5 Changed 10 years ago by Ville Säävuori <Ville@…>

Keywords: l10n fi added

Just noticed a thread on django-dev about documenting these localflavour add-ons. I'm happy to write docs for this one if needed. There's not much to document at the moment, though :)

comment:6 Changed 10 years ago by Malcolm Tredinnick

Triage Stage: AcceptedReady for checkin

Changed 10 years ago by karsu

A Finnish social security number field

comment:7 Changed 10 years ago by karsu

I added patch for Finnish localflavor. It contains new FISocialSecurityNumber field and regressiontests. Is it possible to add it at the same time? It would be nice to create one patch using FIZipCodeField, FIMunicipalitySelect and FISocialSecurityNumber.

comment:8 Changed 10 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [4867]) Fixed #3847 -- Added Finnish localflavor contribution from Ville S?\195?\164?\195?\164vuori.

comment:9 Changed 10 years ago by Malcolm Tredinnick

Resolution: fixed
Status: closedreopened

Whoops .. the extra patch was added just as I was committing Ville's work. I'll merge it together now. although the final patch here appears to be in an invalid format. "Patch" doesn't like it for some reason. Not to worry, though, I can do it manually.

comment:10 Changed 10 years ago by Ville Säävuori <Ville@…>

Whoa. Malcolm was fat. I was just merging this other patch to mine. Oh, well :)

It seems that Trac likes only patches with filename ending '.diff'. Or something.

Thanks Malcolm for your efforts on this.

comment:11 Changed 10 years ago by Ville Säävuori <Ville@…>

Lol. Not fat :D

I'll get mi coat.

comment:12 Changed 10 years ago by Malcolm Tredinnick

Resolution: fixed
Status: reopenedclosed

(In [4868]) Fixed #3847 -- Added validation support for Finnish social security numbers.
Thanks, karsu.

comment:13 Changed 10 years ago by Adrian Holovaty

(In [4890]) Documented HttpResponseBadRequest. Refs #3847 and [4867]

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