jenkins-bot has submitted this change and it was merged.
Change subject: Omit includeredirects parameter for allpages generator
......................................................................
Omit includeredirects parameter for allpages generator
- since includeredirects is listed in deprecated_args, it is never filed to
the allpages parameter list.
- rewrite the filterredir mapping for backward compatibility
- assign includeredirects to filterredir in prefixindex method
- update doc: parameter deprecation is trivially shown by the decorator.
Change-Id: Iea7ea1b5a014025c80cec9e96c9ed2cc177e3244
(cherry picked from commit 187f51bb7d9b4a5083e436d0c7027ea441da4eed)
---
M pywikibot/site.py
1 file changed, 8 insertions(+), 10 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 5e3a53f..519a9a3 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3425,15 +3425,13 @@
'subcats': 0}
return category._catinfo
- @deprecated_args(throttle=None, limit="total",
includeredirects="filterredir")
+ @deprecated_args(throttle=None, limit='total',
+ includeredirects='filterredir')
def allpages(self, start="!", prefix="", namespace=0,
filterredir=None,
filterlanglinks=None, minsize=None, maxsize=None,
protect_type=None, protect_level=None, reverse=False,
- includeredirects=None, step=None, total=None, content=False):
+ step=None, total=None, content=False):
"""Iterate pages in a single namespace.
-
- Note: parameters includeRedirects and throttle are deprecated and
- included only for backwards compatibility.
@param start: Start at this title (page need not exist).
@param prefix: Only yield pages starting with this string.
@@ -3455,16 +3453,16 @@
level; can only be used if protect_type is specified
@param reverse: if True, iterate in reverse Unicode lexigraphic
order (default: iterate in forward order)
- @param includeredirects: DEPRECATED, use filterredir instead
@param content: if True, load the current content of each iterated page
(default False)
@raises KeyError: the namespace identifier was not resolved
@raises TypeError: the namespace identifier has an inappropriate
type such as bool, or an iterable with more than one namespace
"""
- if includeredirects is not None:
- if includeredirects:
- if includeredirects == "only":
+ # backward compatibility test
+ if filterredir not in (True, False, None):
+ if filterredir:
+ if filterredir == 'only':
filterredir = True
else:
filterredir = None
@@ -3504,7 +3502,7 @@
"""
return self.allpages(prefix=prefix, namespace=namespace,
- includeredirects=includeredirects)
+ filterredir=includeredirects)
def alllinks(self, start="!", prefix="", namespace=0,
unique=False,
fromids=False, step=None, total=None):
--
To view, visit
https://gerrit.wikimedia.org/r/243115
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iea7ea1b5a014025c80cec9e96c9ed2cc177e3244
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>