jenkins-bot has submitted this change and it was merged.
Change subject: Don't break cosmetic_changes for InvalidIsbnException
......................................................................
Don't break cosmetic_changes for InvalidIsbnException
isbn.format may fail for unknown publishers. But this should not
break the script except strict parameter is set.
Since cosmetic_changes may called by other scripts, set the lowest
cancel level to break and ignore its changes.
bug: T97836
Change-Id: I68c43f2602fc1dbaef375017c9cb3fb50ca60252
---
M pywikibot/page.py
M scripts/cosmetic_changes.py
2 files changed, 9 insertions(+), 3 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 781c3a0..fb3887b 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1097,7 +1097,8 @@
ccToolkit = CosmeticChangesToolkit(self.site,
redirect=self.isRedirectPage(),
namespace=self.namespace(),
- pageTitle=self.title())
+ pageTitle=self.title(),
+ ignore=3) # CANCEL_MATCH
self.text = ccToolkit.change(old)
if comment and \
old.strip().replace('\r\n',
diff --git a/scripts/cosmetic_changes.py b/scripts/cosmetic_changes.py
index 970cfbc..84e7db1 100755
--- a/scripts/cosmetic_changes.py
+++ b/scripts/cosmetic_changes.py
@@ -66,7 +66,7 @@
cosmetic_changes_deny_script += ['your_script_name_1',
'your_script_name_2']
"""
#
-# (C) xqt, 2009-2013
+# (C) xqt, 2009-2015
# (C) Pywikibot team, 2006-2015
#
# Distributed under the terms of the MIT license.
@@ -198,7 +198,12 @@
return isbn
isbn = scripts_isbn.getIsbn(isbn)
- isbn.format()
+ try:
+ isbn.format()
+ except scripts_isbn.InvalidIsbnException as e:
+ if strict:
+ raise
+ pywikibot.log('ISBN "%s" validation error: %s' % (isbn,
e))
return isbn.code
--
To view, visit
https://gerrit.wikimedia.org/r/208357
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I68c43f2602fc1dbaef375017c9cb3fb50ca60252
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>