jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/534927 )
Change subject: Deprecate the ability to login with a secondary sysop account
......................................................................
Deprecate the ability to login with a secondary sysop account
Once this patch is merged, any part of the code that used to rely on
a secondary sysop account (through the use of sysopnames) should stop
working. I am intentioally postponing the removal of sysopnames from
other parts of code (specifically, pywikibot/__init__.py) to a later
time because this "agile" patch will give us the opportunity of
receiving feedback from users without waiting for a much larger change
to be reviewed.
Bug: T71283
Change-Id: I577ed1b2128856920a8e2a531a53df9fa0e8c5c5
---
M pywikibot/login.py
1 file changed, 10 insertions(+), 21 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/login.py b/pywikibot/login.py
index 3bc7661..4fbe0e9 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -60,8 +60,8 @@
"""Site login manager."""
- @deprecated_args(username='user', verbose=None)
- def __init__(self, password=None, sysop=False, site=None, user=None):
+ @deprecated_args(username='user', verbose=None, sysop=False)
+ def __init__(self, password=None, site=None, user=None):
"""
Initializer.
@@ -74,18 +74,12 @@
@type user: basestring
@param password: password to use
@type password: basestring
- @param sysop: login as sysop account.
- The sysop username is loaded from config.sysopnames.
- @type sysop: bool
@raises NoUsername: No username is configured for the requested site.
"""
site = self.site = site or pywikibot.Site()
if not user:
- if sysop:
- config_names = config.sysopnames
- else:
- config_names = config.usernames
+ config_names = config.usernames
code_to_usr = config_names[site.family.name] or config_names['*']
try:
@@ -93,13 +87,12 @@
except KeyError:
raise NoUsername(
'ERROR: '
- '{account} for {fam_name}:{wiki_code} is undefined.\n'
- 'If you have a {account} for that site, '
+ 'username for {site.family.name}:{site.code} is undefined.'
+ '\nIf you have a username for that site, '
'please add a line to user-config.py as follows:\n'
- "{account}s['{fam_name}']['{wiki_code}'] = 'myUsername'"
- .format(
- fam_name=site.family.name, wiki_code=site.code,
- account='sysopname' if sysop else 'username'))
+ "usernames['{site.family.name}']['{site.code}'] = "
+ "'myUsername'"
+ .format(site=site))
self.password = password
self.login_name = self.username = user
if getattr(config, 'password_file', ''):
@@ -212,7 +205,6 @@
Example::
('my_username', 'my_default_password')
- ('my_sysop_user', 'my_sysop_password')
('wikipedia', 'my_wikipedia_user', 'my_wikipedia_pass')
('en', 'wikipedia', 'my_en_wikipedia_user', 'my_en_wikipedia_pass')
('my_username', BotPassword(
@@ -364,7 +356,8 @@
# NOTE: Currently OauthLoginManager use mwoauth directly to complete OAuth
# authentication process
- def __init__(self, password=None, sysop=False, site=None, user=None):
+ @deprecated_args(sysop=False)
+ def __init__(self, password=None, site=None, user=None):
"""
Initializer.
@@ -376,9 +369,6 @@
@type user: basestring
@param password: consumer secret
@type password: basestring
- @param sysop: login as sysop account.
- The sysop username is loaded from config.sysopnames.
- @type sysop: bool
@raises NoUsername: No username is configured for the requested site.
@raises OAuthImpossible: mwoauth isn't installed
@@ -386,7 +376,6 @@
if isinstance(mwoauth, ImportError):
raise OAuthImpossible('mwoauth is not installed: %s.' % mwoauth)
assert password is not None and user is not None
- assert sysop is False
super(OauthLoginManager, self).__init__(None, False, site, None)
if self.password:
pywikibot.warn('Password exists in password file for %s:%s.'
--
To view, visit https://gerrit.wikimedia.org/r/534927
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I577ed1b2128856920a8e2a531a53df9fa0e8c5c5
Gerrit-Change-Number: 534927
Gerrit-PatchSet: 5
Gerrit-Owner: Huji <huji.huji(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: Huji <huji.huji(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/533884 )
Change subject: [bugfix] Skip the category to be created
......................................................................
[bugfix] Skip the category to be created
Currently the source page will be skipped if it already exists
instead of the target category. This patch solves that bug.
Bug: T231791
Change-Id: I3d219520244574b5ceafc40a50b8f2f0f73c946c
---
M scripts/create_categories.py
1 file changed, 9 insertions(+), 3 deletions(-)
Approvals:
Huji: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/create_categories.py b/scripts/create_categories.py
index d902de8..b42cb8e 100755
--- a/scripts/create_categories.py
+++ b/scripts/create_categories.py
@@ -59,8 +59,9 @@
self.basename = basename
self.overwrite = overwrite
- def treat(self, page):
- """Create category in commons for that page."""
+ def init_page(self, item):
+ """Create a category to be processed with the given page title."""
+ page = super(CreateCategoriesBot, self).init_page(item)
title = page.title(with_ns=False)
newpage = pywikibot.Category(pywikibot.Site('commons', 'commons'),
@@ -68,8 +69,13 @@
newtext = ('[[Category:%(parent)s|%(title)s]]\n'
'[[Category:%(title)s]]\n'
% {'parent': self.parent, 'title': title})
+ newpage.text = newtext
+ return newpage
- self.current_page = newpage
+ def treat(self, page):
+ """Create category in commons for that page."""
+ newtext = page.text
+ self.current_page = page
self.current_page.text = ''
self.put_current(newtext, ignore_server_errors=True)
--
To view, visit https://gerrit.wikimedia.org/r/533884
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I3d219520244574b5ceafc40a50b8f2f0f73c946c
Gerrit-Change-Number: 533884
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Huji <huji.huji(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/533015 )
Change subject: Deprecate sysopnames
......................................................................
Deprecate sysopnames
A future patch will removed all of its use cases.
Sandbox variables are deep copied instead of shallow copied because
for some reason family registration prefill 'sysopnames' with empty
dicts for each family, breaking recursize dict comparison, since the
objects inside and outside of the sandbox refer to the same object.
Bug: T71283
Change-Id: I90277e21aba7923b16316c869ae3815308fd205e
---
M pywikibot/config2.py
1 file changed, 5 insertions(+), 15 deletions(-)
Approvals:
Huji: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 8ef04fc..d3fa7ef 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -40,6 +40,7 @@
from __future__ import absolute_import, division, unicode_literals
import collections
+import copy
import os
import platform
import re
@@ -111,7 +112,7 @@
_private_values = {'authenticate', 'db_password'}
_deprecated_variables = {'use_SSL_onlogin', 'use_SSL_always',
'available_ssl_project', 'fake_user_agent',
- 'special_page_limit'}
+ 'special_page_limit', 'sysopnames'}
# ############# ACCOUNT SETTINGS ##############
@@ -1033,19 +1034,9 @@
if _key[0] != '_' and _key not in _imports}
# Create an environment for user-config.py which is
-# a shallow copy of the core config settings, so that
+# a deep copy of the core config settings, so that
# we can detect modified config items easily.
-_exec_globals = {}
-for _key, _val in _public_globals.items():
- if isinstance(_val, dict):
- if isinstance(_val, collections.defaultdict):
- _exec_globals[_key] = collections.defaultdict(dict)
- else:
- _exec_globals[_key] = {}
- if len(_val) > 0:
- _exec_globals[_key].update(_val)
- else:
- _exec_globals[_key] = _val
+_exec_globals = copy.deepcopy(_public_globals)
# Get the user files
if __no_user_config:
@@ -1126,8 +1117,7 @@
# Copy the user config settings into globals
_modified = {_key for _key in _public_globals.keys()
- if _exec_globals[_key] != globals()[_key]
- or _key in {'usernames', 'sysopnames', 'disambiguation_comment'}}
+ if _exec_globals[_key] != globals()[_key]}
if 'user_agent_format' in _modified:
_right_user_agent_format = re.sub(r'{httplib2(:|})', r'{http_backend\1',
--
To view, visit https://gerrit.wikimedia.org/r/533015
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I90277e21aba7923b16316c869ae3815308fd205e
Gerrit-Change-Number: 533015
Gerrit-PatchSet: 7
Gerrit-Owner: Huji <huji.huji(a)gmail.com>
Gerrit-Reviewer: Huji <huji.huji(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/534922 )
Change subject: Fix the must_be decorator function
......................................................................
Fix the must_be decorator function
Regression introduced in Ie729511867340f38de24e28e55bef1d49c1d6b99
Bug: T231263
Change-Id: Ia6eae6bd31c305360a07f4656fc4fe96be89f4a9
---
M pywikibot/site.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Zhuyifei1999: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index a3f3e06..f63c034 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -1315,7 +1315,7 @@
.format(self.sitename))
if right is not None:
if right in self.userinfo['rights']:
- return
+ return fn(self, *args, **kwargs)
if grp == 'user':
self.login(False)
elif grp == 'sysop':
--
To view, visit https://gerrit.wikimedia.org/r/534922
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia6eae6bd31c305360a07f4656fc4fe96be89f4a9
Gerrit-Change-Number: 534922
Gerrit-PatchSet: 2
Gerrit-Owner: Huji <huji.huji(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/534916 )
Change subject: [FIX] blockpageschecker.py: fix spelling error in docstrings
......................................................................
[FIX] blockpageschecker.py: fix spelling error in docstrings
Replace "then the forget" by "then they forget" in docstrings
Bug: T232251
Change-Id: I87abe67ba00ab88e2f60a5cc749c1ecf23938d5e
---
M scripts/blockpageschecker.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/blockpageschecker.py b/scripts/blockpageschecker.py
index f299a24..0837ada 100755
--- a/scripts/blockpageschecker.py
+++ b/scripts/blockpageschecker.py
@@ -3,7 +3,7 @@
"""
A bot to remove stale protection templates from pages that are not protected.
-Very often sysops block the pages for a set time but then the forget to
+Very often sysops block the pages for a set time but then they forget to
remove the warning! This script is useful if you want to remove those useless
warning left in these pages.
--
To view, visit https://gerrit.wikimedia.org/r/534916
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I87abe67ba00ab88e2f60a5cc749c1ecf23938d5e
Gerrit-Change-Number: 534916
Gerrit-PatchSet: 1
Gerrit-Owner: Mh-3110 <bipi3110(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)