jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/593505 )

Change subject: [IMPR] Login in newitem script if necessary
......................................................................

[IMPR] Login in newitem script if necessary

newitem.py needs to be logged in to run the script.
Otherwise it raises a strange exception:
AttributeError: 'NoneType' object has no attribute 'startswith'
which is a proper message for that reason. Therefore force login if
necessary tho show a proper message.

Bug: T251520
Change-Id: I0bd09b153ac5dbe7af17d3602f5883218c69a5ac
---
M scripts/newitem.py
1 file changed, 2 insertions(+), 0 deletions(-)

Approvals:
  D3r1ck01: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/scripts/newitem.py b/scripts/newitem.py
index 0ff8810..49ad12a 100755
--- a/scripts/newitem.py
+++ b/scripts/newitem.py
@@ -155,6 +155,8 @@
         return

     bot = NewItemRobot(generator, **options)
+    if not bot.site.logged_in():
+        bot.site.login()
     user = pywikibot.User(bot.site, bot.site.username())
     if bot.getOption('touch') == 'newly' \
             and 'autoconfirmed' not in user.groups():

--
To view, visit https://gerrit.wikimedia.org/r/593505
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I0bd09b153ac5dbe7af17d3602f5883218c69a5ac
Gerrit-Change-Number: 593505
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: Matěj Suchánek <[email protected]>
Gerrit-Reviewer: jenkins-bot (75)
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to