Commit c271b573 authored by okhin's avatar okhin 🚴

Correct syntax for with statement

parent dcec8db4
...@@ -149,7 +149,7 @@ def sanitize_phonenumber(number): ...@@ -149,7 +149,7 @@ def sanitize_phonenumber(number):
# We're checking if we're blacklisted # We're checking if we're blacklisted
db = sqlite3.connect(config['piphone']['db']) db = sqlite3.connect(config['piphone']['db'])
bl_re = None bl_re = None
with blacklist in db.execute('SELECT pattern, reason FROM blacklist').fetchall(): with db.execute('SELECT pattern, reason FROM blacklist').fetchall() as blacklist:
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],reason=blacklist[1],)
else: else:
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