jenkins-bot has submitted this change and it was merged.
Change subject: user-config: simple configuration for single username ......................................................................
user-config: simple configuration for single username
Useful for bot with SUL. Allows the use of '*' as lang in user-config.py file, instead of listing all languages (~300)
Change-Id: I54148aa34c20082a638ffa45e8ceda80063e917b --- M generate_user_files.py M pywikibot/__init__.py M pywikibot/config2.py 3 files changed, 11 insertions(+), 3 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/generate_user_files.py b/generate_user_files.py index 914222a..b28f4df 100644 --- a/generate_user_files.py +++ b/generate_user_files.py @@ -238,7 +238,8 @@ mylang = '%s'
# The dictionary usernames should contain a username for each site where you -# have a bot account. +# have a bot account. If you have a unique username for all languages of a +# family , you can use '*' usernames['%s']['%s'] = u'%s'
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py index b3f5438..8fe058c 100644 --- a/pywikibot/__init__.py +++ b/pywikibot/__init__.py @@ -282,6 +282,11 @@ user = config.usernames[fam][code] except KeyError: user = None + if user is None: + try: + user = config.usernames[fam]['*'] + except KeyError: + user = None if sysop is None: try: sysop = config.sysopnames[fam][code] diff --git a/pywikibot/config2.py b/pywikibot/config2.py index 1085ddc..af4ee98 100644 --- a/pywikibot/config2.py +++ b/pywikibot/config2.py @@ -38,14 +38,16 @@ # The dictionary usernames should contain a username for each site where you # have a bot account. Please set your usernames by adding such lines to your # user-config.py: -# # usernames['wikipedia']['de'] = 'myGermanUsername' # usernames['wiktionary']['en'] = 'myEnglishUsername' +# +# If you have a unique username for all languages of a family, +# you can use '*' +# usernames['wikibooks']['*'] = 'mySingleUsername' # # If you have a sysop account on some wikis, this will be used to delete pages # or to edit locked pages if you add such lines to your # user-config.py: -# # sysopnames['wikipedia']['de'] = 'myGermanUsername' # sysopnames['wiktionary']['en'] = 'myEnglishUsername' usernames = {}
pywikibot-commits@lists.wikimedia.org