Xqt has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/396917 )
Change subject: [bugfix] Catch AttributeError and raise the ValueError
......................................................................
[bugfix] Catch AttributeError and raise the ValueError
Bug: T182529
Change-Id: Id03f32e8dc422a22f9998030836da5be8d25af52
---
M pywikibot/proofreadpage.py
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/17/396917/1
diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py
index f4e6a08..2919514 100644
--- a/pywikibot/proofreadpage.py
+++ b/pywikibot/proofreadpage.py
@@ -532,12 +532,12 @@
soup = Soup(response.content)
try:
- # None if nothing is found by .find()
self._url_image = soup.find(class_='prp-page-image')
+ # if None raises AttributeError
self._url_image = self._url_image.find('img')
# if None raises TypeError.
self._url_image = self._url_image['src']
- except TypeError:
+ except (TypeError, AttributeError):
raise ValueError('No prp-page-image src found for %s.' % self)
else:
self._url_image = 'https:' + self._url_image
--
To view, visit https://gerrit.wikimedia.org/r/396917
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id03f32e8dc422a22f9998030836da5be8d25af52
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits