Skip to content

Commit

Permalink
Add to_long Py2/3k normalization function
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddrysdale committed Nov 26, 2011
1 parent 0964219 commit 649b698
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/phonenumbers/phonenumberutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import re

from .re_util import fullmatch # Extra regexp function; see README
from .util import UnicodeMixin, u, prnt
from .util import UnicodeMixin, u, prnt, to_long
from .unicode_util import digit as unicode_digit

# Data class definitions
Expand Down Expand Up @@ -2178,7 +2178,7 @@ def parse(number, region, keep_raw_input=False,
"The string supplied is too long to be a phone number.")
if normalized_national_number[0] == '0':
numobj.italian_leading_zero = True
numobj.national_number = long(normalized_national_number)
numobj.national_number = to_long(normalized_national_number)
return numobj


Expand Down
2 changes: 2 additions & 0 deletions python/phonenumbers/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
u = str
unicode = str
unichr = chr
to_long = int

def prnt(*args, **kwargs):
sep = kwargs.get('sep', ' ')
Expand Down Expand Up @@ -54,6 +55,7 @@ def u(s):
return us

unichr = unichr
to_long = long

def prnt(*args, **kwargs):
sep = kwargs.get('sep', ' ')
Expand Down

0 comments on commit 649b698

Please sign in to comment.