Commit 3233c472 authored by okhin's avatar okhin 🚴

Not mixing up reason and pattern should works best

parent 5e5a6fd4
......@@ -151,9 +151,9 @@ def sanitize_phonenumber(number):
bl_re = None
for blacklist in db.execute('SELECT pattern, reason FROM blacklist').fetchall():
if bl_re == None:
bl_re ='(?P<{reason}>^{pattern})'.format(pattern=blacklist[0].replace(' ', '_'),reason=blacklist[1],)
bl_re ='(?P<{reason}>^{pattern})'.format(pattern=blacklist[0], reason=blacklist[1].replace(' ', '_'),)
else:
bl_re +='|(?P<{reason}>^{pattern})'.format(pattern=blacklist[0].replace(' ', '_'), reason=blacklist[1],)
bl_re +='|(?P<{reason}>^{pattern})'.format(pattern=blacklist[0], reason=blacklist[1].replace(' ', '_'),)
if bl_re != None:
# We have blacklisted patterns, need to chck for them
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