From 4cbc8c62cf0f1e5408425c355cde7b021eb4a31e Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Thu, 29 Nov 2007 18:15:46 +0000 Subject: [PATCH] Fixed #5939 -- Added normalization for New Brunswick in the Canadian provinces. Thanks, rajesh.dhawan@gmail.com. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6744 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- AUTHORS | 1 + django/contrib/localflavor/ca/ca_provinces.py | 2 ++ tests/regressiontests/forms/localflavor/ca.py | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/AUTHORS b/AUTHORS index f393dc7ab0..0768645f1c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -101,6 +101,7 @@ answer newbie questions, and generally made Django that much better: Alex Dedul deric@monowerks.com Max Derkachev + Rajesh Dhawan Sander Dijkhuis Jordan Dimov dne@mayonnaise.net diff --git a/django/contrib/localflavor/ca/ca_provinces.py b/django/contrib/localflavor/ca/ca_provinces.py index 072159ad57..746716fd21 100644 --- a/django/contrib/localflavor/ca/ca_provinces.py +++ b/django/contrib/localflavor/ca/ca_provinces.py @@ -33,6 +33,8 @@ PROVINCES_NORMALIZED = { 'british columbia': 'BC', 'mb': 'MB', 'manitoba': 'MB', + 'nb': 'NB', + 'new brunswick': 'NB', 'nf': 'NF', 'newfoundland': 'NF', 'newfoundland and labrador': 'NF', diff --git a/tests/regressiontests/forms/localflavor/ca.py b/tests/regressiontests/forms/localflavor/ca.py index baeb2ad9a8..a13a6de65f 100644 --- a/tests/regressiontests/forms/localflavor/ca.py +++ b/tests/regressiontests/forms/localflavor/ca.py @@ -147,6 +147,10 @@ u'BC' u'NS' >>> f.clean(' manitoba ') u'MB' +>>> f.clean(' new brunswick ') +u'NB' +>>> f.clean('NB') +u'NB' >>> f.clean('T2S 2H7') Traceback (most recent call last): ...