Commit e787cd79 authored by okhin's avatar okhin 🚴

Merge branch '9-need-to-fix-some-parsing-in-the-blacklist-operations' into 'master'

Let's just replace ' ' by '_'

See merge request !22
parents af368ed4 5e5a6fd4
Pipeline #953 passed with stage
in 5 seconds
...@@ -151,9 +151,9 @@ def sanitize_phonenumber(number): ...@@ -151,9 +151,9 @@ def sanitize_phonenumber(number):
bl_re = None bl_re = None
for blacklist in db.execute('SELECT pattern, reason FROM blacklist').fetchall(): for blacklist in db.execute('SELECT pattern, reason FROM blacklist').fetchall():
if bl_re == None: if bl_re == None:
bl_re ='(?P<{reason}>^{pattern})'.format(pattern=blacklist[0],reason=blacklist[1],) bl_re ='(?P<{reason}>^{pattern})'.format(pattern=blacklist[0].replace(' ', '_'),reason=blacklist[1],)
else: else:
bl_re +='|(?P<{reason}>^{pattern})'.format(pattern=blacklist[0], reason=blacklist[1],) bl_re +='|(?P<{reason}>^{pattern})'.format(pattern=blacklist[0].replace(' ', '_'), reason=blacklist[1],)
if bl_re != None: if bl_re != None:
# We have blacklisted patterns, need to chck for them # We have blacklisted patterns, need to chck for them
groups = re.match(bl_re, number) groups = re.match(bl_re, number)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment