jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/412494 )
Change subject: [cleanup] remove unsupported get_redirect parameter ......................................................................
[cleanup] remove unsupported get_redirect parameter
- Page.templates() and Page.templatesWithParams() doesn't support get_redirect parameter anymore - deprecate get_redirect for Page.templates() method - Show warning for different behaviour between compat and core for Page.templates() method
Change-Id: I97f2db8ed25ac80039103735cf6844c784310b1f --- M pywikibot/page.py M scripts/maintenance/compat2core.py M scripts/solve_disambiguation.py 3 files changed, 6 insertions(+), 4 deletions(-)
Approvals: Mpaa: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py index 6cff93b..7d1babf 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -1540,6 +1540,7 @@ """DEPRECATED. Use templates().""" return self.templates()
+ @deprecate_arg('get_redirect', None) def templates(self, content=False): """ Return a list of Page objects for templates used on this Page. diff --git a/scripts/maintenance/compat2core.py b/scripts/maintenance/compat2core.py index 4e62b64..49ec2fc 100755 --- a/scripts/maintenance/compat2core.py +++ b/scripts/maintenance/compat2core.py @@ -121,6 +121,8 @@ 'the first item of each template info is a Page object of the template,\n' 'not the title. ' 'Please refer README-conversion.txt and the documentation.'), + ('templates(', + 'returns a list of template title not a list of templage page objects.'), )
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py index 49d22a7..dc82dfb 100755 --- a/scripts/solve_disambiguation.py +++ b/scripts/solve_disambiguation.py @@ -614,7 +614,7 @@ }
primary_redir_template = { - # Page.templates() format, first letter uppercase + # First letter uppercase 'hu': u'Egyért-redir', }
@@ -1008,10 +1008,9 @@ if disambPage.isRedirectPage() and not self.primary: if (disambPage.site.lang in self.primary_redir_template and self.primary_redir_template[disambPage.site.lang] - in disambPage.templates(get_redirect=True)): + in disambPage.templates()): baseTerm = disambPage.title() - for template in disambPage.templatesWithParams( - get_redirect=True): + for template in disambPage.templatesWithParams(): if template[0] == self.primary_redir_template[ disambPage.site.lang] \ and len(template[1]) > 0:
pywikibot-commits@lists.wikimedia.org