jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/337281 )
Change subject: checkimages.py: Prevent TypeError when self.num_notify is None
......................................................................
checkimages.py: Prevent TypeError when self.num_notify is None
When the max notification is not set, self.num_notify will be None
instead of defaultdict, and attempting to reduce the value of an
element will result in:
TypeError: 'NoneType' object has no attribute '__getitem__'
We check if self.num_notify is not None earlier in order to prevent
this exception.
The logic of checking if the counter has ran out has also been changed
from `not value` to `value == 0` for clarity.
Follow up for I9e25b35d42af3c73c581c6d05a6a4a8dc8ef62c6
Bug: T157728
Change-Id: I7d5966c52dff4b342942abe030295f3e3c1f422f
---
M scripts/checkimages.py
1 file changed, 3 insertions(+), 2 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index d4207a7..a56bd56 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -778,7 +778,7 @@
# Check maximum number of notifications for this talk page
if (self.num_notify is not None and
- not self.num_notify[self.talk_page.title()]):
+ self.num_notify[self.talk_page.title()] == 0):
pywikibot.output('Maximum notifications reached, skip.')
return
@@ -787,7 +787,8 @@
except pywikibot.LockedPage:
pywikibot.output(u'Talk page blocked, skip.')
else:
- self.num_notify[self.talk_page.title()] -= 1
+ if self.num_notify is not None:
+ self.num_notify[self.talk_page.title()] -= 1
if emailPageName and emailSubj:
emailPage = pywikibot.Page(self.site, emailPageName)
--
To view, visit https://gerrit.wikimedia.org/r/337281
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7d5966c52dff4b342942abe030295f3e3c1f422f
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #3836
Status: Errored
Duration: 45 minutes and 14 seconds
Commit: ad83102 (master)
Author: Matěj Suchánek
Message: Workaround for T111513
It is wasteful to interrupt the bot just because of an unsupported
interwiki link. Here, we only test if it *is* an interwiki link, then we
skip it whatever syntax it has. This error only confirms that.
Bug: T136280
Change-Id: If013e15e4282fd29ef6f0f81e8c6f984d7fde70e
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/6b99dbd73db0...ad83102e…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/200912212
--
You can configure recipients for build notifications in your .travis.yml file. See https://docs.travis-ci.com/user/notifications