mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-24 08:13:53 +00:00
catpcha.py: Use opts.output
Script fails on macOS Python 3.9.2 otherwise, with "name 'output' is not
defined".
Change-Id: Id3df19b4a4dedf69f860f1a41348770ac1207377
(cherry picked from commit d1bc02e2fb
)
This commit is contained in:
parent
12794e686c
commit
ab98badbb6
|
@ -204,11 +204,11 @@ def run_in_thread(object):
|
||||||
md5hash = hashlib.md5((key+salt+word+key+salt).encode('utf-8')).hexdigest()[:16]
|
md5hash = hashlib.md5((key+salt+word+key+salt).encode('utf-8')).hexdigest()[:16]
|
||||||
filename = "image_%s_%s.png" % (salt, md5hash)
|
filename = "image_%s_%s.png" % (salt, md5hash)
|
||||||
if opts.dirs:
|
if opts.dirs:
|
||||||
subdir = gen_subdir(output, md5hash, dirs)
|
subdir = gen_subdir(opts.output, md5hash, dirs)
|
||||||
filename = os.path.join(subdir, filename)
|
filename = os.path.join(subdir, filename)
|
||||||
if opts.verbose:
|
if opts.verbose:
|
||||||
print(filename)
|
print(filename)
|
||||||
gen_captcha(word, font, fontsize, os.path.join(output, filename))
|
gen_captcha(word, font, fontsize, os.path.join(opts.output, filename))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
"""This grabs random words from the dictionary 'words' (one
|
"""This grabs random words from the dictionary 'words' (one
|
||||||
|
|
|
@ -221,11 +221,11 @@ def run_in_thread(object):
|
||||||
md5hash = hashlib.md5((key+salt+word+key+salt).encode('utf-8')).hexdigest()[:16]
|
md5hash = hashlib.md5((key+salt+word+key+salt).encode('utf-8')).hexdigest()[:16]
|
||||||
filename = "image_%s_%s.png" % (salt, md5hash)
|
filename = "image_%s_%s.png" % (salt, md5hash)
|
||||||
if opts.dirs:
|
if opts.dirs:
|
||||||
subdir = gen_subdir(output, md5hash, dirs)
|
subdir = gen_subdir(opts.output, md5hash, dirs)
|
||||||
filename = os.path.join(subdir, filename)
|
filename = os.path.join(subdir, filename)
|
||||||
if opts.verbose:
|
if opts.verbose:
|
||||||
print(filename)
|
print(filename)
|
||||||
gen_captcha(word, font, fontsize, os.path.join(output, filename))
|
gen_captcha(word, font, fontsize, os.path.join(opts.output, filename))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
"""This grabs random words from the dictionary 'words' (one
|
"""This grabs random words from the dictionary 'words' (one
|
||||||
|
|
Loading…
Reference in a new issue