Xqt has uploaded a new change for review.
https://gerrit.wikimedia.org/r/221062
Change subject: Ommit includeredirects parameter for allpages generator
......................................................................
Ommit 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
- deprecate includeredirects for prefixindex method
- update doc: parameter deprecation is trivially shown by the decorator.
Change-Id: Iea7ea1b5a014025c80cec9e96c9ed2cc177e3244
---
M pywikibot/site.py
1 file changed, 10 insertions(+), 11 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/62/221062/1
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 3e1f637..3a24f3e 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3503,15 +3503,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.
@@ -3533,16 +3531,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
@@ -3575,14 +3573,15 @@
return apgen
@deprecated("Site.allpages()")
- def prefixindex(self, prefix, namespace=0, includeredirects=True):
+ @deprecated_args(includeredirects='filterredir')
+ def prefixindex(self, prefix, namespace=0, filterredir=True):
"""Yield all pages with a given prefix. Deprecated.
Use allpages() with the prefix= parameter instead of this method.
"""
return self.allpages(prefix=prefix, namespace=namespace,
- includeredirects=includeredirects)
+ filterredir=filterredir)
def alllinks(self, start="!", prefix="", namespace=0, unique=False,
fromids=False, step=None, total=None):
--
To view, visit https://gerrit.wikimedia.org/r/221062
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iea7ea1b5a014025c80cec9e96c9ed2cc177e3244
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits