Page MenuHomePhabricator
Paste P7236

bot.py: Enforce username on all language of a family
ActivePublic

Authored by Dalba on Jun 10 2018, 12:17 PM.
index 84f40735..a0c29b03 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -920,7 +920,7 @@ def handle_args(args=None, do_help=True):
if not module_name:
module_name = 'terminal-interface'
non_global_args = []
- username = None
+ lang = username = None
do_help = None if do_help else False
for arg in args:
option, sep, value = arg.partition(':')
@@ -931,7 +931,7 @@ def handle_args(args=None, do_help=True):
elif option == '-family':
config.family = value
elif option == '-lang':
- config.mylang = value
+ lang = config.mylang = value
elif option == '-user':
username = value
elif option in ('-putthrottle', '-pt'):
@@ -1001,7 +1001,10 @@ def handle_args(args=None, do_help=True):
non_global_args.append(arg)
if username:
- config.usernames[config.family][config.mylang] = username
+ if lang:
+ config.usernames[config.family][lang] = username
+ else:
+ config.usernames[config.family] = {'*': username}
init_handlers()
writeToCommandLogFile()