jenkins-bot submitted this change.
cleanup: boolean *watch* parameter of BasePage.save is desupported
Bug: T378898
Change-Id: I872e7c4720585d1be8ecaeb7f1364a08c53379de
---
M ROADMAP.rst
M pywikibot/page/_basepage.py
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/ROADMAP.rst b/ROADMAP.rst
index bea3c86..b8fc450 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -11,6 +11,7 @@
**Breaking changes and code cleanups**
+* A boolean *watch* parameter in :meth:`page.BasePage.save` is desupported
* ``XMLDumpOldPageGenerator`` was removed in favour of a ``content`` parameter of
:func:`pagegenerators.XMLDumpPageGenerator` (:phab:`T306134`)
* :meth:`pywikibot.User.is_blocked` method was renamed from ``isBlocked`` for consistency
@@ -105,6 +106,5 @@
arguments must be used instead.
* 7.2.0: ``tb`` parameter of :func:`exception()<pywikibot.logging.exception>` function was renamed to ``exc_info``
* 7.1.0: Unused ``get_redirect`` parameter of :meth:`Page.getOldVersion()<page.BasePage.getOldVersion>` will be removed
-* 7.0.0: A boolean watch parameter in Page.save() is deprecated and will be desupported
* 7.0.0: baserevid parameter of editSource(), editQualifier(), removeClaims(), removeSources(), remove_qualifiers()
DataSite methods will be removed
diff --git a/pywikibot/page/_basepage.py b/pywikibot/page/_basepage.py
index 28ad6db..8210f17 100644
--- a/pywikibot/page/_basepage.py
+++ b/pywikibot/page/_basepage.py
@@ -18,7 +18,7 @@
import pywikibot
from pywikibot import Timestamp, config, date, i18n, textlib, tools
-from pywikibot.backports import Generator, Iterable
+from pywikibot.backports import Generator, Iterable, NoneType
from pywikibot.cosmetic_changes import CANCEL, CosmeticChangesToolkit
from pywikibot.exceptions import (
Error,
@@ -1293,6 +1293,8 @@
edits cannot be marked as bot edits if the bot account has no
``bot`` right. Therefore a ``None`` argument for *bot*
parameter was dropped.
+ .. versionchanged:: 10.0
+ boolean *watch* parameter is desupported
.. hint:: Setting up :manpage:`OAuth` or :manpage:`BotPassword
<BotPasswords>` login, you have to grant
@@ -1333,21 +1335,22 @@
:param quiet: enable/disable successful save operation message;
defaults to False. In asynchronous mode, if True, it is up
to the calling bot to manage the output e.g. via callback.
+ :raises TypeError: watch parameter must be a string literal or
+ None
+ :raises OtherPageSaveError: Editing restricted by a template.
"""
if not summary:
summary = config.default_edit_summary
- if isinstance(watch, bool): # pragma: no cover
- issue_deprecation_warning(
- 'boolean watch parameter',
- '"watch", "unwatch", "preferences" or "nochange" value',
- since='7.0.0')
- watch = ('unwatch', 'watch')[watch]
-
+ if not isinstance(watch, (str, NoneType)):
+ raise TypeError(
+ f'watch parameter must be a string literal, not {watch}')
if not force and not self.botMayEdit():
raise OtherPageSaveError(
self, 'Editing restricted by {{bots}}, {{nobots}} '
- "or site's equivalent of {{in use}} template")
+ "or site's equivalent of {{in use}} template"
+ )
+
self._save(summary=summary, watch=watch, minor=minor, bot=bot,
asynchronous=asynchronous, callback=callback,
cc=apply_cosmetic_changes, quiet=quiet, **kwargs)
To view, visit change 1100774. To unsubscribe, or for help writing mail filters, visit settings.