jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/434101 )
Change subject: [bugfix] Handle 'mark for deletion' of ItemPage.delete() ......................................................................
[bugfix] Handle 'mark for deletion' of ItemPage.delete()
Bug: T134563 Change-Id: I06660a1d8750ffce3cf9317afad91daac7e1a5bc --- M pywikibot/page.py 1 file changed, 9 insertions(+), 2 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py index d8f63fc..570cb6a 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -1910,8 +1910,15 @@ self.site._noMarkDeletePrompt = True if answer == 'y': template = '{{delete|1=%s}}\n' % reason - self.text = template + self.text - return self.save(summary=reason) + # We can't add templates in a wikidata item, so let's use its + # talk page + if isinstance(self, pywikibot.ItemPage): + talk = self.toggleTalkPage() + talk.text = template + talk.text + talk.save(summary=reason) + else: + self.text = template + self.text + self.save(summary=reason)
@deprecated_args(step=None) def loadDeletedRevisions(self, total=None):
pywikibot-commits@lists.wikimedia.org