jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/351928 )
Change subject: Replace private mylang variables with mycode in generate_user_files.py
......................................................................
Replace private mylang variables with mycode in generate_user_files.py
site.code is the identifying code of a site presumed to be equal to the
wiki prefix whereas site language is the ISO language code for a site.
e.g. 'als' is a site code whereas its site language is 'gsw'
'meta' is a site code whereas its language is 'en'
local variable should follow this difference
Change-Id: I91d06c919b1b0e25c1538a1f6f4e6f86f7b0fb22
---
M generate_user_files.py
1 file changed, 16 insertions(+), 16 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/generate_user_files.py b/generate_user_files.py
index 74837a1..930eeb3 100755
--- a/generate_user_files.py
+++ b/generate_user_files.py
@@ -142,22 +142,22 @@
default_lang = None
message = "The language code of the site we're working on"
- mylang = None
- while not mylang:
- mylang = pywikibot.input(message, default=default_lang, force=force)
- if known_langs and mylang and mylang not in known_langs:
+ mycode = None
+ while not mycode:
+ mycode = pywikibot.input(message, default=default_lang, force=force)
+ if known_langs and mycode and mycode not in known_langs:
if not pywikibot.input_yn("The language code {0} is not in the "
"list of known languages. Do you want "
- "to continue?".format(mylang),
+ "to continue?".format(mycode),
default=False, automatic_quit=False):
- mylang = None
+ mycode = None
- message = u"Username on {0}:{1}".format(mylang, fam.name)
+ message = 'Username on {0}:{1}'.format(mycode, fam.name)
username = pywikibot.input(message, default=default_username, force=force)
# Escape ''s
if username:
username = username.replace("'", "\\'")
- return fam.name, mylang, username
+ return fam.name, mycode, username
EXTENDED_CONFIG = """# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
@@ -196,7 +196,7 @@
family = '{main_family}'
# The language code of the site we're working on.
-mylang = '{main_lang}'
+mylang = '{main_code}'
# The dictionary usernames should contain a username for each site where you
# have a bot account. If you have a unique username for all languages of a
@@ -209,7 +209,7 @@
SMALL_CONFIG = ('# -*- coding: utf-8 -*-\n'
u"from __future__ import absolute_import, unicode_literals\n"
u"family = '{main_family}'\n"
- u"mylang = '{main_lang}'\n"
+ "mylang = '{main_code}'\n"
u"{usernames}\n")
@@ -221,22 +221,22 @@
if args and force and not config.verbose_output:
# main_username may be None, which is used in the next block
- main_family, main_lang, main_username = args
+ main_family, main_code, main_username = args
usernames = [args]
else:
- main_family, main_lang, main_username = get_site_and_lang(*args,
+ main_family, main_code, main_username = get_site_and_lang(*args,
force=force)
- usernames = [(main_family, main_lang, main_username)]
+ usernames = [(main_family, main_code, main_username)]
while pywikibot.input_yn("Do you want to add any other projects?",
force=force,
default=False, automatic_quit=False):
- usernames += [get_site_and_lang(main_family, main_lang,
+ usernames += [get_site_and_lang(main_family, main_code,
main_username)]
if not main_username:
usernames = "# usernames['{0}']['{1}'] =
u'MyUsername'".format(
- main_family, main_lang)
+ main_family, main_code)
else:
usernames = '\n'.join(
u"usernames['{0}']['{1}'] =
u'{2}'".format(*username)
@@ -289,7 +289,7 @@
try:
with codecs.open(_fnc, "w", "utf-8") as f:
f.write(config_content.format(main_family=main_family,
- main_lang=main_lang,
+ main_code=main_code,
usernames=usernames,
config_text=config_text))
--
To view, visit
https://gerrit.wikimedia.org/r/351928
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I91d06c919b1b0e25c1538a1f6f4e6f86f7b0fb22
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>