From 3953e838f8e45551ea3a93d7609df4266c72766e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Tisza?= Date: Fri, 28 Jul 2023 14:58:57 -0700 Subject: [PATCH] Make badwordlist optional Follows up I8e758023b38a4d450a0bf02b3bfc0b5033959be7. Bug: T277936 Change-Id: I20f896f86875c9b11e8a998bca6e08f8c38554c1 --- blacklist => badwordlist | 0 captcha-old.py | 2 ++ captcha.py | 2 ++ 3 files changed, 4 insertions(+) rename blacklist => badwordlist (100%) diff --git a/blacklist b/badwordlist similarity index 100% rename from blacklist rename to badwordlist diff --git a/captcha-old.py b/captcha-old.py index 3fb2c5c46..358b8e67e 100644 --- a/captcha-old.py +++ b/captcha-old.py @@ -172,6 +172,8 @@ def pick_word(words, badwordlist, verbose, nwords, min_length, max_length): sys.exit("Unable to find valid word combinations") def read_wordlist(filename): + if not os.path.isfile(filename): + return [] f = open(filename) words = [x.strip().lower() for x in f.readlines()] f.close() diff --git a/captcha.py b/captcha.py index bb13e21cc..fd758bcb5 100644 --- a/captcha.py +++ b/captcha.py @@ -189,6 +189,8 @@ def pick_word(words, badwordlist, verbose, nwords, min_length, max_length): sys.exit("Unable to find valid word combinations") def read_wordlist(filename): + if not os.path.isfile(filename): + return [] f = open(filename) words = [x.strip().lower() for x in f.readlines()] f.close()