jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1052713?usp=email )
Change subject: [doc] update ROADMAP.rst ......................................................................
[doc] update ROADMAP.rst
Change-Id: I75bd053280fc6d31621d87f9d32fa337d41bfced --- M ROADMAP.rst M pywikibot/page/_page.py 2 files changed, 15 insertions(+), 5 deletions(-)
Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
diff --git a/ROADMAP.rst b/ROADMAP.rst index 4c59145..ce8bc73 100644 --- a/ROADMAP.rst +++ b/ROADMAP.rst @@ -1,9 +1,12 @@ Current Release Changes =======================
+* *botflag* parameter of :meth:`page.BasePage.save`, :meth:`page.BasePage.put`, :meth:`page.BasePage.touch`, + :meth:`pywikibot.Page.set_redirect_target` and :meth:`pywikibot.ItemPage.set_redirect_target` was renamed to *bot* to + be in sync with :meth:`APISite.editpage<pywikibot.site._apisite.APISite.editpage>` and :api:`edit`. * use :meth:`page.BasePage.templates` in :meth:`Page.templatesWithParams<page.Page.templatesWithParams>` to cache templates -* Re-implement :meth:`Page.main_authors()<page._toolforge.WikiBlameMixin.main_authors>` as +* Re-implement :meth:`Page.main_authors()<page._toolforge.WikiBlameMixin.main_authors>` as :meth:`Page.authorship()<page._toolforge.WikiBlameMixin.authorship>` using ``xtools`` (:phab:`T366100`); ``wikitextparser`` packages is required for it.
@@ -73,7 +76,7 @@ * 7.3.0: Old color escape sequences like ``\03{color}`` is deprecated in favour of new color format like <<color>> * 7.3.0: ``linktrail`` method of :class:`family.Family` is deprecated; use :meth:`APISite.linktrail() <pywikibot.site._apisite.APISite.linktrail>` instead -* 7.2.0: Positional arguments *decoder*, *layer* and *newline* for :mod:`logging` functions where dropped; keyword +* 7.2.0: Positional arguments *decoder*, *layer* and *newline* for :mod:`logging` functions where dropped; keyword arguments must be used instead. * 7.2.0: ``tb`` parameter of :func:`exception()<pywikibot.logging.exception>` function was renamed to ``exc_info`` * 7.2.0: XMLDumpOldPageGenerator is deprecated in favour of a ``content`` parameter of diff --git a/pywikibot/page/_page.py b/pywikibot/page/_page.py index b89bc2c..2154ea9 100644 --- a/pywikibot/page/_page.py +++ b/pywikibot/page/_page.py @@ -28,7 +28,7 @@ from pywikibot.page._basepage import BasePage from pywikibot.page._toolforge import WikiBlameMixin from pywikibot.site import Namespace -from pywikibot.tools import cached +from pywikibot.tools import cached, deprecated_args
__all__ = ['Page'] @@ -122,6 +122,7 @@ result.append((pywikibot.Page(link, self.site), positional)) return result
+ @deprecated_args(botflag='bot') # since 9.3.0 def set_redirect_target( self, target_page, @@ -134,6 +135,9 @@ """ Change the page's text to point to the redirect page.
+ .. versionchanged:: 9.3 + *botflag* keyword parameter was renamed to *bot*. + :param target_page: target of the redirect, this argument is required. :type target_page: pywikibot.Page or string :param create: if true, it creates the redirect even if the page @@ -150,15 +154,19 @@ target_page = pywikibot.Page(self.site, target_page) elif self.site != target_page.site: raise InterwikiRedirectPageError(self, target_page) + if not self.exists() and not (create or force): raise NoPageError(self) + if self.exists() and not self.isRedirectPage() and not force: raise IsNotRedirectPageError(self) + redirect_regex = self.site.redirect_regex if self.exists(): old_text = self.get(get_redirect=True) else: old_text = '' + result = redirect_regex.search(old_text) if result: oldlink = result[1] @@ -172,8 +180,7 @@ prefix = self.text[:result.start()] suffix = self.text[result.end():] else: - prefix = '' - suffix = '' + prefix = suffix = ''
target_link = target_page.title(as_link=True, textlink=True, allow_interwiki=False)
pywikibot-commits@lists.wikimedia.org