jenkins-bot submitted this change.

View Change

Approvals: JJMC89: Looks good to me, but someone else must approve Xqt: Looks good to me, approved jenkins-bot: Verified
page.botMayEdit: Use site.username() instead of site.user()

site.user() only returns a username when the bot is logged in, according
to site.logged_in(). However, bots using OAUTH are not considered to be
logged in, so site.user() returns None. This causes OAUTH bots to ignore
the username lists in {{bots}}, which is highly undesireble.

site.username() will return the username that the bot would use if it
were currently logged-in, regardless of if it is or not. If no username
is specified at all, it returns an empty string instead of None. This
will still result in botMayEdit ignoring the username list when no
username is found.

Bug: T153541
Change-Id: Icf9e6f2c7181ddcf908475b075a5eff32a8abf78
---
M pywikibot/page/__init__.py
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index a4605a0..027de03 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -1186,7 +1186,7 @@
if config.ignore_bot_templates: # Check the "master ignore switch"
return True

- username = self.site.user()
+ username = self.site.username()
try:
templates = self.templatesWithParams()
except (pywikibot.NoPage,

To view, visit change 609277. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Icf9e6f2c7181ddcf908475b075a5eff32a8abf78
Gerrit-Change-Number: 609277
Gerrit-PatchSet: 1
Gerrit-Owner: AntiCompositeNumber <anticompositenumber+wmcs@gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999@gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged