jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/428889 )
Change subject: Allow archivebot to archive even restricted pages
......................................................................
Allow archivebot to archive even restricted pages
The archive templates were recently added to templates which restricts
page to be edited, but it made archivebot not archive at all.
This patch excludes archive templates from restrictions and introduces a
method to filter out archive templates if archivebot is there.
TODO: This patch could be possibly expanded to some form of force
categories like:
page.save(force='always') x 'archive' x None
Change-Id: Iab249fd83f4f071b4694eba8d0b7d977ed22c3f8
---
M pywikibot/families/wikipedia_family.py
M pywikibot/family.py
M pywikibot/page.py
3 files changed, 25 insertions(+), 5 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/families/wikipedia_family.py
b/pywikibot/families/wikipedia_family.py
index 0960980..b0234f6 100644
--- a/pywikibot/families/wikipedia_family.py
+++ b/pywikibot/families/wikipedia_family.py
@@ -205,11 +205,8 @@
self.edit_restricted_templates = {
'ar': ('تحرر',),
'bs': ('Izmjena u toku',),
- 'cs': ('Pracuje se', 'Archiv', 'Archiv
Wikipedie',
- 'Archiv diskuse', 'Archivace start', 'Posloupnost
archivů',
- 'Rfa-archiv-start', 'Rfc-archiv-start',),
- 'de': ('Inuse', 'In use', 'In bearbeitung',
'Inbearbeitung',
- 'Archiv',),
+ 'cs': ('Pracuje se',),
+ 'de': ('Inuse', 'In use', 'In bearbeitung',
'Inbearbeitung',),
'en': ('Inuse', 'In use'),
'fa': ('ویرایش',),
'fr': ('En cours', 'Plusieurs en cours',
'Correction en cours',
@@ -220,6 +217,15 @@
'zh': ('Inuse',),
}
+ # Archive templates that indicate an edit of non-archive bots
+ # should be avoided
+ self.archived_page_templates = {
+ 'cs': ('Archiv', 'Archiv Wikipedie', 'Archiv
diskuse',
+ 'Archivace start', 'Posloupnost archivů',
+ 'Rfa-archiv-start', 'Rfc-archiv-start',),
+ 'de': ('Archiv',),
+ }
+
def get_known_families(self, site):
"""Override the family interwiki prefixes for each
site."""
# In Swedish Wikipedia 's:' is part of page title not a family
diff --git a/pywikibot/family.py b/pywikibot/family.py
index ff18c20..936fbb9 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -730,6 +730,11 @@
# that indicate an edit should be avoided
self.edit_restricted_templates = {}
+ # A dict of tuples for different sites with names of archive
+ # templates that indicate an edit of non-archive bots
+ # should be avoided
+ self.archived_page_templates = {}
+
# A list of projects that share cross-project sessions.
if not hasattr(self, 'cross_projects'):
self.cross_projects = []
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 91ee48c..6957e70 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1171,6 +1171,15 @@
# multiple bots/nobots templates are allowed
restrictions = self.site.family.edit_restricted_templates.get(
self.site.code)
+ # also add archive templates for non-archive bots
+ if pywikibot.calledModuleName() != 'archivebot':
+ archived = self.site.family.archived_page_templates.get(
+ self.site.code)
+ if restrictions and archived:
+ restrictions += archived
+ elif archived:
+ restrictions = archived
+
for template, params in templates:
title = template.title(withNamespace=False)
if restrictions:
--
To view, visit
https://gerrit.wikimedia.org/r/428889
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iab249fd83f4f071b4694eba8d0b7d977ed22c3f8
Gerrit-Change-Number: 428889
Gerrit-PatchSet: 5
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>