jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/407917 )
Change subject: [bugfix] Fix using templatesWithParams results ......................................................................
[bugfix] Fix using templatesWithParams results
- templatesWithParams gives a Page object as first tuple item but not a string use it's title to compare it - follow pep8 naming convention for the method variables
Bug: T186412 Change-Id: I270de96d9364f823134eaa744fe6eaca2066b24e --- M pywikibot/login.py 1 file changed, 9 insertions(+), 9 deletions(-)
Approvals: Dalba: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/login.py b/pywikibot/login.py index 6b133fb..478cb20 100644 --- a/pywikibot/login.py +++ b/pywikibot/login.py @@ -3,7 +3,7 @@ """Library to log the bot in to a wiki account.""" # # (C) Rob W.W. Hooft, 2003 -# (C) Pywikibot team, 2003-2017 +# (C) Pywikibot team, 2003-2018 # # Distributed under the terms of the MIT license. # @@ -165,17 +165,17 @@ """ if self.site.family.name in botList \ and self.site.code in botList[self.site.family.name]: - botListPageTitle, botTemplate = botList[ + botlist_pagetitle, bot_template_title = botList[ self.site.family.name][self.site.code] - botListPage = pywikibot.Page(self.site, botListPageTitle) - if botTemplate: - for template in botListPage.templatesWithParams(): - if template[0] == botTemplate \ - and template[1][0] == self.username: + botlist_page = pywikibot.Page(self.site, botlist_pagetitle) + if bot_template_title: + for template, params in botlist_page.templatesWithParams(): + if (template.title() == bot_template_title + and params[0] == self.username): return True else: - for linkedPage in botListPage.linkedPages(): - if linkedPage.title(withNamespace=False) == self.username: + for linked_page in botlist_page.linkedPages(): + if linked_page.title(withNamespace=False) == self.username: return True return False else:
pywikibot-commits@lists.wikimedia.org