jenkins-bot submitted this change.
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.