jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/770148 )

Change subject: [FEAT] Enable use of deletetalk parameter of the delete API
......................................................................

[FEAT] Enable use of deletetalk parameter of the delete API

Change-Id: I3b2e9fdb6ca4f1894c6a97da6f57fc3631dd4cbc
---
M pywikibot/page/__init__.py
M pywikibot/site/_apisite.py
2 files changed, 34 insertions(+), 9 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index 2d030ce..9f4671e 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -1758,16 +1758,24 @@
                                   movetalk=movetalk,
                                   noredirect=noredirect)

-    def delete(self,
-               reason: Optional[str] = None,
-               prompt: bool = True,
-               mark: bool = False,
-               automatic_quit: bool = False) -> None:
+    def delete(
+        self,
+        reason: Optional[str] = None,
+        prompt: bool = True,
+        mark: bool = False,
+        automatic_quit: bool = False,
+        *,
+        deletetalk: bool = False
+    ) -> None:
         """
         Delete the page from the wiki. Requires administrator status.

+        .. versionchanged:: 7.1
+           keyword only parameter *deletetalk* was added.
+
         :param reason: The edit summary for the deletion, or rationale
             for deletion if requesting. If None, ask for it.
+        :param deletetalk: Also delete the talk page, if it exists.
         :param prompt: If true, prompt user for confirmation before deleting.
         :param mark: If true, and user does not have sysop rights, place a
             speedy-deletion request on the page instead. If false, non-sysops
@@ -1792,7 +1800,7 @@
                     answer = 'y'
                     self.site._noDeletePrompt = True
             if answer == 'y':
-                self.site.delete(self, reason)
+                self.site.delete(self, reason, deletetalk=deletetalk)
             return

         # Otherwise mark it for deletion
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index c5df593..ef2b67d 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -2112,7 +2112,14 @@
     }  # other errors shouldn't occur because of pre-submission checks

     @need_right('delete')
-    def delete(self, page, reason: str, *, oldimage: Optional[str] = None):
+    def delete(
+        self,
+        page: Union['pywikibot.page.BasePage', int, str],
+        reason: str,
+        *,
+        deletetalk: bool = False,
+        oldimage: Optional[str] = None
+    ) -> None:
         """Delete a page or a specific old version of a file from the wiki.

         Requires appropriate privileges.
@@ -2128,10 +2135,12 @@
         .. versionchanged:: 6.1
            keyword only parameter *oldimage* was added.

+        .. versionchanged:: 7.1
+           keyword only parameter *deletetalk* was added.
+
         :param page: Page to be deleted or its pageid.
-        :type page: :py:obj:`pywikibot.page.BasePage` or, for pageid,
-            int or str
         :param reason: Deletion reason.
+        :param deletetalk: Also delete the talk page, if it exists.
         :param oldimage: oldimage id of the file version to be deleted.
             If a BasePage object is given with page parameter, it has to
             be a FilePage.
@@ -2158,6 +2167,14 @@
             params['pageid'] = pageid
             msg = pageid

+        if deletetalk:
+            if self.mw_version < '1.38wmf24':
+                pywikibot.warning(
+                    'deletetalk is not available on {}'.format(self.mw_version)
+                )
+            else:
+                params['deletetalk'] = deletetalk
+
         req = self._simple_request(**params)
         self.lock_page(page)
         try:

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/770148
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I3b2e9fdb6ca4f1894c6a97da6f57fc3631dd4cbc
Gerrit-Change-Number: 770148
Gerrit-PatchSet: 3
Gerrit-Owner: JJMC89 <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to