Permalink
Browse files

Remove leading zeros from tel numbers

  • Loading branch information...
1 parent deedc40 commit 116e2682a681e93a2b9a63c335fa0a641c153eed @aaronbassett aaronbassett committed Aug 2, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/tel/templatetags/tel.py
View
3 src/tel/templatetags/tel.py
@@ -67,6 +67,7 @@ def norm_tel(raw):
normalize a telephone number, including converting any letters to numbers
Strip out any non-numeric characters, after converting any letters to digits.
+ Remove leading zeros
@param raw : The unprocessed number
@type raw : unicode
@@ -75,7 +76,7 @@ def norm_tel(raw):
@rtype : unicode
'''
- return u''.join(map(char_to_digit, filter(is_alphanum, raw.upper())))[:NUMBER_SIZE]
+ return u''.join(map(char_to_digit, filter(is_alphanum, raw.lstrip("0").upper())))[:NUMBER_SIZE]
def tel(raw):
'''

0 comments on commit 116e268

Please sign in to comment.