jenkins-bot has submitted this change and it was merged. Change subject: Changed Page.change_category for category_redirect ......................................................................
Changed Page.change_category for category_redirect Note #1: Page.change_category now returns True or False instead of always None. Note #2: The category_redirect version of change_category saves the page also if it is not changed. Since MediaWiki automatically purges pages this is imho not needed. The original does not do this. Note #3: This should fix the bug reported in bug 59119 Change-Id: I0dd0c3758b3c6dfa542ddba44fc6139a9b415d3e --- M pywikibot/page.py 1 file changed, 6 insertions(+), 2 deletions(-) Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified diff --git a/pywikibot/page.py b/pywikibot/page.py index f0150cd..6504d10 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -1455,6 +1455,7 @@ @param inPlace: if True, change categories in place rather than rearranging them. + @return: True if page was saved changed, otherwise False. """ # get list of Category objects the article is in and remove possible @@ -1472,12 +1473,12 @@ if not self.canBeEdited(): pywikibot.output(u"Can't edit %s, skipping it..." % self.title(asLink=True)) - return + return False if oldCat not in cats: pywikibot.error(u'%s is not in category %s!' % (self.title(asLink=True), oldCat.title())) - return + return False if inPlace or self.namespace() == 10: oldtext = self.get(get_redirect=True) @@ -1496,10 +1497,12 @@ # a ValueError is in the case of interwiki links to self. pywikibot.output(u'Skipping %s because of interwiki link to ' u'self' % self.title()) + return False if oldtext != newtext: try: self.put(newtext, comment) + return True except pywikibot.EditConflict: pywikibot.output(u'Skipping %s because of edit conflict' % self.title()) @@ -1515,6 +1518,7 @@ except pywikibot.PageNotSaved as error: pywikibot.output(u'Saving page %s failed: %s' % (self.title(asLink=True), error.message)) + return False @property def categoryinfo(self): -- To view, visit https://gerrit.wikimedia.org/r/104669 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0dd0c3758b3c6dfa542ddba44fc6139a9b415d3e Gerrit-PatchSet: 2 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