jenkins-bot has submitted this change and it was merged.
Change subject: [bugfix] Detect KeyError exception instead of NoPage
......................................................................
[bugfix] Detect KeyError exception instead of NoPage
NoPage exception is already handled previously. Now there might be
an ImagePage without image content. This leads to a KeyError but
not to pywikibot.NoPage exception. Now the right exceptions is
detected.
Bug: T87172
Change-Id: I09541dfb719f7618a773c3a4e7ded441218a1d63
---
M checkimages.py
1 file changed, 6 insertions(+), 3 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/checkimages.py b/checkimages.py
index c21e1ae..73fab19 100644
--- a/checkimages.py
+++ b/checkimages.py
@@ -735,7 +735,7 @@
nick = self.uploader
else:
nick = reportPageObject.getLatestUploader()[0]
- except pywikibot.NoPage:
+ except KeyError:
pywikibot.output(
u"Seems that %s has only the description and not the file..."
% self.image_to_report)
@@ -1049,7 +1049,10 @@
if DupePage.urlname() != self.image.urlname() or \
self.timestamp is None:
- self.timestamp = DupePage.getLatestUploader()[1]
+ try:
+ self.timestamp = DupePage.getLatestUploader()[1]
+ except KeyError:
+ continue
data = time.strptime(self.timestamp,
u"%Y-%m-%dT%H:%M:%SZ")
data_seconds = time.mktime(data)
time_image_list.append([data_seconds, duplicate])
@@ -1556,7 +1559,7 @@
for image in generator:
try:
timestamp = image.getLatestUploader()[1]
- except pywikibot.NoPage:
+ except (pywikibot.NoPage, KeyError):
continue
# not relative to localtime
img_time = datetime.datetime.strptime(timestamp,
--
To view, visit
https://gerrit.wikimedia.org/r/185820
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I09541dfb719f7618a773c3a4e7ded441218a1d63
Gerrit-PatchSet: 4
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>