[MediaWiki-commits] [Gerrit] Prevent Page.change_category from readding newCat. - change (pywikibot/core)
Pyfisch has uploaded a new change for review. https://gerrit.wikimedia.org/r/104812 Change subject: Prevent Page.change_category from readding newCat. .. Prevent Page.change_category from readding newCat. Currently change_category also adds newCat if it is already present at the target page. This behavior had to be fixed manually by calling functions like category.py and causes extra code and complexity. Change-Id: I95ba291e78c2f187f4d4a881b39fa44096cca9b6 --- M pywikibot/page.py 1 file changed, 4 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/12/104812/1 diff --git a/pywikibot/page.py b/pywikibot/page.py index f0150cd..2cda41e 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -1479,6 +1479,10 @@ % (self.title(asLink=True), oldCat.title())) return +# This prevents the bot from adding newCat if it is already present. +if newCat in cats: +newCat = None + if inPlace or self.namespace() == 10: oldtext = self.get(get_redirect=True) newtext = pywikibot.replaceCategoryInPlace(oldtext, oldCat, newCat) -- To view, visit https://gerrit.wikimedia.org/r/104812 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I95ba291e78c2f187f4d4a881b39fa44096cca9b6 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Pyfisch pyfi...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Prevent Page.change_category from readding newCat. - change (pywikibot/core)
jenkins-bot has submitted this change and it was merged. Change subject: Prevent Page.change_category from readding newCat. .. Prevent Page.change_category from readding newCat. Currently change_category also adds newCat if it is already present at the target page. This behavior had to be fixed manually by calling functions like category.py and causes extra code and complexity. Change-Id: I95ba291e78c2f187f4d4a881b39fa44096cca9b6 --- M pywikibot/page.py 1 file changed, 4 insertions(+), 0 deletions(-) Approvals: Merlijn van Deen: Looks good to me, approved jenkins-bot: Verified diff --git a/pywikibot/page.py b/pywikibot/page.py index f0150cd..2cda41e 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -1479,6 +1479,10 @@ % (self.title(asLink=True), oldCat.title())) return +# This prevents the bot from adding newCat if it is already present. +if newCat in cats: +newCat = None + if inPlace or self.namespace() == 10: oldtext = self.get(get_redirect=True) newtext = pywikibot.replaceCategoryInPlace(oldtext, oldCat, newCat) -- To view, visit https://gerrit.wikimedia.org/r/104812 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I95ba291e78c2f187f4d4a881b39fa44096cca9b6 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Pyfisch pyfi...@gmail.com Gerrit-Reviewer: Ladsgroup ladsgr...@gmail.com Gerrit-Reviewer: Merlijn van Deen valhall...@arctus.nl Gerrit-Reviewer: Xqt i...@gno.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits