jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/522883 )
Change subject: test(test_access_denied_notexist_username): update the error message
......................................................................
test(test_access_denied_notexist_username): update the error message
Apparently the error message has changed slightly in MW 1.34.0-wmf.13,
however I was not able to locate the change that has caused this.
Bug: T227951
Change-Id: I3e82fa0e45cfc1a63d29485ec91a77071902c5b9
---
M tests/api_tests.py
1 file changed, 4 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/api_tests.py b/tests/api_tests.py
index f08dbe8..18d7603 100644
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -1022,7 +1022,10 @@
self.assertRaises(pywikibot.NoUsername, req.submit)
# FIXME: T100965
self.assertRaises(api.APIError, req.submit)
- error.assert_called_with('Login failed (Failed).')
+ try:
+ error.assert_called_with('Login failed (readapidenied).')
+ except AssertionError: # MW version is older than 1.34.0-wmf.13
+ error.assert_called_with('Login failed (Failed).')
warning.assert_called_with(
'API error readapidenied: '
'You need read permission to use this module.')
--
To view, visit https://gerrit.wikimedia.org/r/522883
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: I3e82fa0e45cfc1a63d29485ec91a77071902c5b9
Gerrit-Change-Number: 522883
Gerrit-PatchSet: 2
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(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/522734 )
Change subject: [bugfix] Ignore references in harvest_template.py
......................................................................
[bugfix] Ignore references in harvest_template.py
Bug: T227954
Change-Id: I6fcdb342728fecfccd9dca24126698cd0a877d02
---
M scripts/harvest_template.py
1 file changed, 4 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/harvest_template.py b/scripts/harvest_template.py
index 94404eb..16edcd9 100755
--- a/scripts/harvest_template.py
+++ b/scripts/harvest_template.py
@@ -267,7 +267,10 @@
# We found the template we were looking for
for field, value in fielddict.items():
field = field.strip()
- value = value.strip()
+ # todo: extend the list of tags to ignore
+ value = textlib.removeDisabledParts(
+ # todo: eventually we may want to import the references
+ value, tags=['ref'], site=page.site).strip()
if not field or not value:
continue
--
To view, visit https://gerrit.wikimedia.org/r/522734
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: I6fcdb342728fecfccd9dca24126698cd0a877d02
Gerrit-Change-Number: 522734
Gerrit-PatchSet: 1
Gerrit-Owner: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(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/498696 )
Change subject: [IMPR] Move categories without leaving a redirect
......................................................................
[IMPR] Move categories without leaving a redirect
This will be the new default action if the user has the suppressredirect right.
Bug: T150093
Change-Id: If34a66c4ae1df502b46f2f2f1878852e9901e4a1
---
M scripts/category.py
1 file changed, 11 insertions(+), 7 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/category.py b/scripts/category.py
index 3c0985a..5927a27 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -575,6 +575,10 @@
self.site = pywikibot.Site()
self.can_move_cats = (
'move-categorypages' in self.site.userinfo['rights'])
+ self.noredirect = (
+ delete_oldcat
+ and 'suppressredirect' in self.site.userinfo['rights']
+ )
# Create attributes for the categories and their talk pages.
self.oldcat = self._makecat(oldcat)
self.oldtalk = self.oldcat.toggleTalkPage()
@@ -678,7 +682,8 @@
old_cat_text = self.oldcat.text
self.newcat = self.oldcat.move(self.newcat.title(),
reason=self.move_comment,
- movetalk=can_move_talk)
+ movetalk=can_move_talk,
+ noredirect=self.noredirect)
# Copy over the article text so it can be stripped of
# CFD templates and re-saved. This is faster than
# reloading the article in place.
@@ -714,12 +719,11 @@
Do not use this function from outside the class. Automatically marks
the pages if they can't be removed due to missing permissions.
"""
- if moved_page:
- self.oldcat.delete(self.deletion_comment,
- not self.batch, mark=True)
- if moved_talk:
- self.oldtalk.delete(self.deletion_comment,
- not self.batch,
+ if moved_page and self.oldcat.exists():
+ self.oldcat.delete(self.deletion_comment, not self.batch,
+ mark=True)
+ if moved_talk and self.oldtalk.exists():
+ self.oldtalk.delete(self.deletion_comment, not self.batch,
mark=True)
def _change(self, gen):
--
To view, visit https://gerrit.wikimedia.org/r/498696
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: If34a66c4ae1df502b46f2f2f1878852e9901e4a1
Gerrit-Change-Number: 498696
Gerrit-PatchSet: 6
Gerrit-Owner: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-CC: Zoranzoki21 <zorandori4444(a)gmail.com>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/517604 )
Change subject: feat(APISite.purgepages): raise error on invalid arguments
......................................................................
feat(APISite.purgepages): raise error on invalid arguments
Also add param info to the docstrings of BasePage.purge and purgepages.
Bug: T225993
Change-Id: I1b59d9749c5668a54be8c86dfaedbdce98f810f2
---
M pywikibot/page.py
M pywikibot/site.py
2 files changed, 42 insertions(+), 13 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index fb7507d..f93dbd9 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1412,6 +1412,17 @@
"""
Purge the server's cache for this page.
+ @keyword redirects: Automatically resolve redirects.
+ @type redirects: bool
+ @keyword converttitles: Convert titles to other variants if necessary.
+ Only works if the wiki's content language supports variant
+ conversion.
+ @type converttitles: bool
+ @keyword forcelinkupdate: Update the links tables.
+ @type forcelinkupdate: bool
+ @keyword forcerecursivelinkupdate: Update the links table, and update
+ the links tables for any page that uses this page as a template.
+ @type forcerecursivelinkupdate: bool
@rtype: bool
"""
self.clear_cache()
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 04e0e87..ee2c84c 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -6049,32 +6049,50 @@
return ('unwatched' if unwatch else 'watched') in result['watch']
@must_be(group='user')
- def purgepages(self, pages, **kwargs):
+ def purgepages(
+ self, pages, forcelinkupdate=False, forcerecursivelinkupdate=False,
+ converttitles=False, redirects=False
+ ):
"""
Purge the server's cache for one or multiple pages.
- @see: U{https://www.mediawiki.org/wiki/API:Purge}
-
@param pages: list of Page objects
+ @param redirects: Automatically resolve redirects.
+ @type redirects: bool
+ @param converttitles: Convert titles to other variants if necessary.
+ Only works if the wiki's content language supports variant
+ conversion.
+ @type converttitles: bool
+ @param forcelinkupdate: Update the links tables.
+ @type forcelinkupdate: bool
+ @param forcerecursivelinkupdate: Update the links table, and update the
+ links tables for any page that uses this page as a template.
+ @type forcerecursivelinkupdate: bool
@return: True if API returned expected response; False otherwise
@rtype: bool
"""
req = self._simple_request(action='purge',
titles=[page for page in set(pages)])
- linkupdate_args = ['forcelinkupdate', 'forcerecursivelinkupdate']
- for arg in kwargs:
- if arg in linkupdate_args + ['redirects', 'converttitles']:
- req[arg] = kwargs[arg]
+ if converttitles:
+ req['converttitles'] = True
+ if redirects:
+ req['redirects'] = True
+ if forcelinkupdate:
+ req['forcelinkupdate'] = True
+ if forcerecursivelinkupdate:
+ req['forcerecursivelinkupdate'] = True
result = req.submit()
- if 'purge' not in result:
+ try:
+ result = result['purge']
+ except KeyError:
pywikibot.error(
'purgepages: Unexpected API response:\n%s' % result)
return False
- result = result['purge']
- purged = ['purged' in page for page in result]
- if any(kwargs.get(arg) for arg in linkupdate_args):
- purged += ['linkupdate' in page for page in result]
- return all(purged)
+ if not all('purged' in page for page in result):
+ return False
+ if forcelinkupdate or forcerecursivelinkupdate:
+ return all('linkupdate' in page for page in result)
+ return True
@deprecated('Site().exturlusage', since='20090529')
def linksearch(self, siteurl, limit=None, euprotocol=None):
--
To view, visit https://gerrit.wikimedia.org/r/517604
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: I1b59d9749c5668a54be8c86dfaedbdce98f810f2
Gerrit-Change-Number: 517604
Gerrit-PatchSet: 5
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(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/516309 )
Change subject: [bugfix] Enable choosing protect level with check_protection_level
......................................................................
[bugfix] Enable choosing protect level with check_protection_level
levels option passed to check_protection_level is a set
which cannot be indexed. Convert that set to a list first.
Also return if level is found in levels.
Dedent the other part.
Bug: T225448
Change-Id: I9c80f8663a86f5d6c80f7ac72db2268543564f88
---
M scripts/protect.py
1 file changed, 24 insertions(+), 21 deletions(-)
Approvals:
Lokal Profil: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/protect.py b/scripts/protect.py
index b2fd560..af8d779 100755
--- a/scripts/protect.py
+++ b/scripts/protect.py
@@ -123,29 +123,32 @@
@return: a valid protection level
@rtype: str
"""
- if level not in levels:
- first_char = []
- default_char = None
- num = 1
- for level in levels:
- for c in level:
- if c not in first_char:
- first_char.append(c)
- break
- else:
- first_char.append(str(num))
- num += 1
- if level == default:
- default_char = first_char[-1]
- choice = pywikibot.input_choice('Choice a protection level to {0}:'
- .format(operation),
- zip(levels, first_char),
- default=default_char)
-
- return levels[first_char.index(choice)]
- else:
+ if level in levels:
return level
+ # ask for a valid level
+ levels = sorted(levels) # sort to be deterministic
+ first_char = []
+ default_char = None
+ num = 1
+ for level in levels:
+ for c in level:
+ if c not in first_char:
+ first_char.append(c)
+ break
+ else:
+ first_char.append(str(num))
+ num += 1
+ if level == default:
+ default_char = first_char[-1]
+
+ choice = pywikibot.input_choice('Choose a protection level to {0}:'
+ .format(operation),
+ zip(levels, first_char),
+ default=default_char)
+
+ return levels[first_char.index(choice)]
+
def main(*args):
"""
--
To view, visit https://gerrit.wikimedia.org/r/516309
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: I9c80f8663a86f5d6c80f7ac72db2268543564f88
Gerrit-Change-Number: 516309
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Lokal Profil <andre.costa(a)wikimedia.se>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(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/521027 )
Change subject: [bugfix] Do not use pydocstyle 4.0.0 until upstream issue is solved
......................................................................
[bugfix] Do not use pydocstyle 4.0.0 until upstream issue is solved
Do not use pydocstyle 4.0.0 until flake8-docstring problem with pydocstyle
is solved upstream.
Bug: T227403
Change-Id: I06b433a4a7701fff62be21e0f4c577c8f77a0408
---
M setup.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/setup.py b/setup.py
index 9f125f7..6262505 100644
--- a/setup.py
+++ b/setup.py
@@ -37,7 +37,7 @@
dependencies = ['requests>=2.20.0']
-pydocstyle = 'pydocstyle<=3.0.0' if PY2 else 'pydocstyle>=2.5.0'
+pydocstyle = 'pydocstyle<=3.0.0' if PY2 else 'pydocstyle>=2.5.0,!=4.0.0'
if PY2:
pillow = 'Pillow<7.0.0'
elif PYTHON_VERSION < (3, 5):
--
To view, visit https://gerrit.wikimedia.org/r/521027
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: I06b433a4a7701fff62be21e0f4c577c8f77a0408
Gerrit-Change-Number: 521027
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/520986 )
Change subject: djvu.py: fix name of variable for filename
......................................................................
djvu.py: fix name of variable for filename
Wrong variable name used in one line:
- file -> filename
Change-Id: Ibde422b65c7a8695a5face074ea3ef70fd9fae26
---
M pywikibot/tools/djvu.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/tools/djvu.py b/pywikibot/tools/djvu.py
index b0507d5..859127e 100644
--- a/pywikibot/tools/djvu.py
+++ b/pywikibot/tools/djvu.py
@@ -81,7 +81,7 @@
"""
self._filename = file
filename = os.path.expanduser(file)
- filename = os.path.abspath(file)
+ filename = os.path.abspath(filename)
# Check file exists and has read permissions.
with open(filename):
self.file = filename
--
To view, visit https://gerrit.wikimedia.org/r/520986
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: Ibde422b65c7a8695a5face074ea3ef70fd9fae26
Gerrit-Change-Number: 520986
Gerrit-PatchSet: 1
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)