Code

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#3847 closed (fixed)

Add Finnish localflavor

Reported by: Ville Säävuori <Ville@…> Owned by: adrian
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@…> 7 years ago.
fi_localflavor_unicode.diff (35.1 KB) - added by Ville Säävuori <Ville@…> 7 years ago.
A better patch (hopefully). This time with unicode strings.
fi_localflavor_social_security_number.patch (3.1 KB) - added by karsu 7 years ago.
A Finnish social security number field

Download all attachments as: .zip

Change History (16)

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

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

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 7 years ago by mtredinnick

  • 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 7 years ago by mtredinnick

  • Triage Stage changed from Ready for checkin to Accepted

comment:4 Changed 7 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 7 years ago by Ville Säävuori <Ville@…>

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

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

  • Keywords localflavor, l10n, fi added; localflavor removed

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 7 years ago by mtredinnick

  • Triage Stage changed from Accepted to Ready for checkin

Changed 7 years ago by karsu

A Finnish social security number field

comment:7 Changed 7 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 7 years ago by mtredinnick

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

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

comment:9 Changed 7 years ago by mtredinnick

  • Resolution fixed deleted
  • Status changed from closed to reopened

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 7 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 7 years ago by Ville Säävuori <Ville@…>

Lol. Not fat :D

I'll get mi coat.

comment:12 Changed 7 years ago by mtredinnick

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

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

comment:13 Changed 7 years ago by adrian

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.