jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1189975?usp=email )

Change subject: [bugfix] Return userPut result with put_current method in 
AutomaticTWSummaryBot
......................................................................

[bugfix] Return userPut result with put_current method in AutomaticTWSummaryBot

Change-Id: If62349de27bb3f6845101822b8d62f8078f6ee94
---
M ROADMAP.rst
M pywikibot/bot.py
M tests/interwikidata_tests.py
3 files changed, 34 insertions(+), 17 deletions(-)

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




diff --git a/ROADMAP.rst b/ROADMAP.rst
index ba5f818..69367fd 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,7 +1,8 @@
 Current Release Changes
 =======================

-* (no changes yet)
+* Return :meth:`bot.BaseBot.userPut` result with 
:meth:`AutomaticTWSummaryBot.put_current()
+  <bot.AutomaticTWSummaryBot.put_current>` method


 Deprecations
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 9aab5c2..d3457ae 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1840,21 +1840,26 @@
         self.current_page = page
         self.treat_page()

-    def put_current(self, new_text: str,
-                    ignore_save_related_errors: bool | None = None,
-                    ignore_server_errors: bool | None = None,
-                    **kwargs: Any) -> bool:
+    def put_current(
+        self,
+        new_text: str,
+        ignore_save_related_errors: bool | None = None,
+        ignore_server_errors: bool | None = None,
+        **kwargs: Any
+    ) -> bool:
         """Call :py:obj:`Bot.userPut` but use the current page.

         It compares the new_text to the current page text.

         :param new_text: The new text
-        :param ignore_save_related_errors: Ignore save related errors and
-            automatically print a message. If None uses this instances default.
-        :param ignore_server_errors: Ignore server errors and automatically
-            print a message. If None uses this instances default.
+        :param ignore_save_related_errors: Ignore save related errors
+            and automatically print a message. If None uses this
+            instances default.
+        :param ignore_server_errors: Ignore server errors and
+            automatically print a message. If None uses this instances
+            default.
         :param kwargs: Additional parameters directly given to
-            :py:obj:`Bot.userPut`.
+            :meth:`BaseBot.userPut`.
         :return: whether the page was saved successfully
         """
         if ignore_save_related_errors is None:
@@ -1862,10 +1867,13 @@
         if ignore_server_errors is None:
             ignore_server_errors = self.ignore_server_errors
         return self.userPut(
-            self.current_page, self.current_page.text, new_text,
+            self.current_page,
+            self.current_page.text,
+            new_text,
             ignore_save_related_errors=ignore_save_related_errors,
             ignore_server_errors=ignore_server_errors,
-            **kwargs)
+            **kwargs
+        )


 class AutomaticTWSummaryBot(CurrentPageBot):
@@ -1902,8 +1910,14 @@
         """Delete the i18n dictionary."""
         del self._summary_parameters

-    def put_current(self, *args: Any, **kwargs: Any) -> None:
-        """Defining a summary if not already defined and then call original."""
+    def put_current(self, *args: Any, **kwargs: Any) -> bool:
+        """Defining a summary if not already defined and then call original.
+
+        For parameters see :meth:`CurrentPageBot.put_current`
+
+        .. versionchanged:: 10.6
+           return whether the page was saved successfully
+        """
         if not kwargs.get('summary'):
             if self.summary_key is None:
                 raise ValueError('The summary_key must be set.')
@@ -1912,7 +1926,8 @@
                                        self.summary_parameters)
             _log(f'Use automatic summary message "{summary}"')
             kwargs['summary'] = summary
-        super().put_current(*args, **kwargs)
+
+        return super().put_current(*args, **kwargs)


 class ExistingPageBot(CurrentPageBot):
diff --git a/tests/interwikidata_tests.py b/tests/interwikidata_tests.py
index 7a77ef3..97291ef 100755
--- a/tests/interwikidata_tests.py
+++ b/tests/interwikidata_tests.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 """Tests for scripts/interwikidata.py."""
 #
-# (C) Pywikibot team, 2015-2024
+# (C) Pywikibot team, 2015-2025
 #
 # Distributed under the terms of the MIT license.
 #
@@ -9,6 +9,7 @@

 import unittest
 from contextlib import suppress
+from typing import Any

 import pywikibot
 from pywikibot import Link
@@ -21,7 +22,7 @@

     """A dummy bot to prevent editing in production wikis."""

-    def put_current(self) -> bool:
+    def put_current(self, *args: Any, **kwargs: Any) -> bool:
         """Prevent editing."""
         return False


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

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

Reply via email to