jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/574111 )
Change subject: [bugfix] Raise InvalidTitle for title containing illegal char
......................................................................
[bugfix] Raise InvalidTitle for title containing illegal char
+ use the same error message as below in parse()
+ use %r instead of '%s' % repr() in both errors
Bug: T181443
Change-Id: Ie9dafebd0b07fe1467a50eb49976dddf059bc305
---
M pywikibot/page.py
1 file changed, 3 insertions(+), 5 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 18e41d0..032096e 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -6039,11 +6039,9 @@
t = unicodedata.normalize('NFC', t)
# This code was adapted from Title.php : secureAndSplit()
- #
if '\ufffd' in t:
- raise pywikibot.Error(
- "Title contains illegal char (\\uFFFD 'REPLACEMENT
CHARACTER')"
- )
+ raise pywikibot.InvalidTitle(
+ '%r contains illegal char %r' % (t, '\ufffd'))
# Cleanup whitespace
t = re.sub(
@@ -6182,7 +6180,7 @@
m = Link.illegal_titles_pattern.search(t)
if m:
raise pywikibot.InvalidTitle(
- '%s contains illegal char(s) %s' % (repr(t), repr(m.group(0))))
+ '%r contains illegal char(s) %r' % (t, m.group(0)))
# Pages with "/./" or "/../" appearing in the URLs will
# often be unreachable due to the way web browsers deal
--
To view, visit
https://gerrit.wikimedia.org/r/574111
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: Ie9dafebd0b07fe1467a50eb49976dddf059bc305
Gerrit-Change-Number: 574111
Gerrit-PatchSet: 8
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Zhuyifei1999 <zhuyifei1999(a)gmail.com>