mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-23 15:56:50 +00:00
Make badwordlist optional
Follows up I8e758023b38a4d450a0bf02b3bfc0b5033959be7. Bug: T277936 Change-Id: I20f896f86875c9b11e8a998bca6e08f8c38554c1
This commit is contained in:
parent
2dda9540a5
commit
3953e838f8
|
@ -172,6 +172,8 @@ def pick_word(words, badwordlist, verbose, nwords, min_length, max_length):
|
||||||
sys.exit("Unable to find valid word combinations")
|
sys.exit("Unable to find valid word combinations")
|
||||||
|
|
||||||
def read_wordlist(filename):
|
def read_wordlist(filename):
|
||||||
|
if not os.path.isfile(filename):
|
||||||
|
return []
|
||||||
f = open(filename)
|
f = open(filename)
|
||||||
words = [x.strip().lower() for x in f.readlines()]
|
words = [x.strip().lower() for x in f.readlines()]
|
||||||
f.close()
|
f.close()
|
||||||
|
|
|
@ -189,6 +189,8 @@ def pick_word(words, badwordlist, verbose, nwords, min_length, max_length):
|
||||||
sys.exit("Unable to find valid word combinations")
|
sys.exit("Unable to find valid word combinations")
|
||||||
|
|
||||||
def read_wordlist(filename):
|
def read_wordlist(filename):
|
||||||
|
if not os.path.isfile(filename):
|
||||||
|
return []
|
||||||
f = open(filename)
|
f = open(filename)
|
||||||
words = [x.strip().lower() for x in f.readlines()]
|
words = [x.strip().lower() for x in f.readlines()]
|
||||||
f.close()
|
f.close()
|
||||||
|
|
Loading…
Reference in a new issue