jenkins-bot has submitted this change and it was merged.
Change subject: pagegenerators.RedirectFilterPageGenerator ......................................................................
pagegenerators.RedirectFilterPageGenerator
Added the possibility to filter pages that are redirects or not redirects.
Change-Id: I4e5d428062a8789485c55b07286b65ac977b9ee3 --- M pywikibot/pagegenerators.py 1 file changed, 5 insertions(+), 3 deletions(-)
Approvals: Legoktm: Looks good to me, approved Xqt: Looks good to me, but someone else must approve Merlijn van Deen: Looks good to me, but someone else must approve jenkins-bot: Verified
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py index d04b2f9..7617323 100644 --- a/pywikibot/pagegenerators.py +++ b/pywikibot/pagegenerators.py @@ -750,10 +750,12 @@ yield page
-def RedirectFilterPageGenerator(generator): - """Yields pages from another generator that are not redirects.""" +def RedirectFilterPageGenerator(generator, no_redirects=True): + """Yields pages from another generator that are redirects or not.""" for page in generator: - if not page.isRedirectPage(): + if not page.isRedirectPage() and no_redirects: + yield page + elif page.isRedirectPage() and not no_redirects: yield page
pywikibot-commits@lists.wikimedia.org