jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/336882 )
Change subject: Allow bot parameter in set_redirect_target ......................................................................
Allow bot parameter in set_redirect_target
Change-Id: Ia0c44aeff7961c1a42c53a36134ef2ff590b00b2 --- M pywikibot/page.py M pywikibot/site.py 2 files changed, 7 insertions(+), 3 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py index 0771788..a249933 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -4607,7 +4607,8 @@ if not save or keep_section or create: raise NotImplementedError data = self.repo.set_redirect_target( - from_item=self, to_item=target_page) + from_item=self, to_item=target_page, + bot=kwargs.get('botflag', True)) if data.get('success', 0): del self.latest_revision_id self._isredir = True diff --git a/pywikibot/site.py b/pywikibot/site.py index be63f15..e063133 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -8089,7 +8089,7 @@ return data
@must_be(group='user') - def set_redirect_target(self, from_item, to_item): + def set_redirect_target(self, from_item, to_item, bot=True): """ Make a redirect to another item.
@@ -8097,12 +8097,15 @@ @type to_item: pywikibot.ItemPage @param from_item: Title of the item to be redirected. @type from_item: pywikibot.ItemPage + @param bot: Whether to mark the edit as a bot edit + @type bot: bool """ params = { 'action': 'wbcreateredirect', 'from': from_item.getID(), 'to': to_item.getID(), - 'token': self.tokens['edit'] + 'token': self.tokens['edit'], + 'bot': bot, } req = self._simple_request(**params) data = req.submit()