diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-02-13 14:43:33 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-02-13 14:43:33 +0000 |
| commit | f30a4b368cd6a03dfbbfd2145d06f747664ece86 (patch) | |
| tree | a91c87a1e715d36686816ae92194922a25420afd /django/utils | |
| parent | d751f2cade81b6a8cf325ab5dd081c015f727ef3 (diff) | |
[1.1.X] Fixed #12613 -- Added Q and Z to the list of characters supported by the phone2numeric filter. Thanks to gabrielhurley for the report and patch.
Backport of r12425 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12427 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/text.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/django/utils/text.py b/django/utils/text.py index fe46e26b52..37599c15be 100644 --- a/django/utils/text.py +++ b/django/utils/text.py @@ -157,12 +157,12 @@ recapitalize = allow_lazy(recapitalize) def phone2numeric(phone): "Converts a phone number with letters into its numeric equivalent." - letters = re.compile(r'[A-PR-Y]', re.I) - char2number = lambda m: {'a': '2', 'c': '2', 'b': '2', 'e': '3', - 'd': '3', 'g': '4', 'f': '3', 'i': '4', 'h': '4', 'k': '5', - 'j': '5', 'm': '6', 'l': '5', 'o': '6', 'n': '6', 'p': '7', - 's': '7', 'r': '7', 'u': '8', 't': '8', 'w': '9', 'v': '8', - 'y': '9', 'x': '9'}.get(m.group(0).lower()) + letters = re.compile(r'[A-Z]', re.I) + char2number = lambda m: {'a': '2', 'b': '2', 'c': '2', 'd': '3', 'e': '3', + 'f': '3', 'g': '4', 'h': '4', 'i': '4', 'j': '5', 'k': '5', 'l': '5', + 'm': '6', 'n': '6', 'o': '6', 'p': '7', 'q': '7', 'r': '7', 's': '7', + 't': '8', 'u': '8', 'v': '8', 'w': '9', 'x': '9', 'y': '9', 'z': '9', + }.get(m.group(0).lower()) return letters.sub(char2number, phone) phone2numeric = allow_lazy(phone2numeric) |
