jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1078976?usp=email )
Change subject: [IMPR] Show strong messages in case of missing error code in
Page.authorship()
......................................................................
[IMPR] Show strong messages in case of missing error code in Page.authorship()
Bug: T376815
Change-Id: Ib92e857f6042ab7f7627737105c25469b4e1077e
---
M pywikibot/page/_toolforge.py
1 file changed, 10 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
Ammarpad: Looks good to me, but someone else must approve
diff --git a/pywikibot/page/_toolforge.py b/pywikibot/page/_toolforge.py
index 047beb6..29b22e9 100644
--- a/pywikibot/page/_toolforge.py
+++ b/pywikibot/page/_toolforge.py
@@ -192,7 +192,16 @@
table = wikitextparser.parse(r.text).tables[0]
except IndexError:
pattern = textlib.get_regexes('code')[0]
- msg = textlib.removeHTMLParts(pattern.search(r.text)[0])
+ match = pattern.search(r.text)
+ if match:
+ msg = textlib.removeHTMLParts(match[0])
+ else:
+ pattern = textlib.get_regexes('strong')[0]
+ strongs = pattern.findall(r.text)
+ if strongs:
+ msg = textlib.removeHTMLParts('\n'.join(strongs))
+ else:
+ msg = 'Unknown exception from xtools'
raise pywikibot.exceptions.Error(msg) from None
pct_sum = 0.0
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1078976?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ib92e857f6042ab7f7627737105c25469b4e1077e
Gerrit-Change-Number: 1078976
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Ammarpad <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]