Skip to content

Commit 9598d8a

Browse files
committed
fix(an-web): add check to ddd or number phone when catch state in normalize region
1 parent 2f82d76 commit 9598d8a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

action-network/web/utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
def find_by_ddd(ddd):
55
"""Return state by DDD"""
6+
if len(ddd) > 2:
7+
match = re.search(r"\+55\s*\((\d{2})\)", ddd)
8+
if match:
9+
ddd = str(match.group(1))
10+
611
states = dict(
712
DF=['61', 'Distrito Federal'],
813
GO=['62','64', 'Goiania', 'Goiânia'],
@@ -33,7 +38,7 @@ def find_by_ddd(ddd):
3338
SC=['47','48','49', 'Santa Catarina']
3439
)
3540

36-
state = ddd
41+
state = None
3742

3843
for index, values in enumerate(states.values()):
3944
if ddd in values:

0 commit comments

Comments
 (0)