Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Remove leading zeros from tel numbers

  • Loading branch information...
commit 116e2682a681e93a2b9a63c335fa0a641c153eed 1 parent deedc40
Aaron Bassett aaronbassett authored

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. +2 1  src/tel/templatetags/tel.py
3  src/tel/templatetags/tel.py
@@ -67,6 +67,7 @@ def norm_tel(raw):
67 67 normalize a telephone number, including converting any letters to numbers
68 68
69 69 Strip out any non-numeric characters, after converting any letters to digits.
  70 + Remove leading zeros
70 71
71 72 @param raw : The unprocessed number
72 73 @type raw : unicode
@@ -75,7 +76,7 @@ def norm_tel(raw):
75 76 @rtype : unicode
76 77
77 78 '''
78   - return u''.join(map(char_to_digit, filter(is_alphanum, raw.upper())))[:NUMBER_SIZE]
  79 + return u''.join(map(char_to_digit, filter(is_alphanum, raw.lstrip("0").upper())))[:NUMBER_SIZE]
79 80
80 81 def tel(raw):
81 82 '''

0 comments on commit 116e268

Please sign in to comment.
Something went wrong with that request. Please try again.