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>