jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/378654 )
Change subject: family.py: Simplify category_redirects method
......................................................................
family.py: Simplify category_redirects method
_get_cr_templates always sets a value for _catredirtemplates[code], therefore
checking for `if code in self._catredirtemplates` is not necessary and the
KeyError will never be raised.
Change-Id: Id94bf466063a58bf6311e6a84128f854d09c19d1
---
M pywikibot/family.py
1 file changed, 1 insertion(+), 5 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/family.py b/pywikibot/family.py
index 4f3bd43..b708069 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -1005,11 +1005,7 @@
if not hasattr(self, "_catredirtemplates") or \
code not in self._catredirtemplates:
self._get_cr_templates(code, fallback)
- if code in self._catredirtemplates:
- return self._catredirtemplates[code]
- else:
- raise KeyError("ERROR: title for category redirect template in "
- "language '%s' unknown" % code)
+ return self._catredirtemplates[code]
def _get_cr_templates(self, code, fallback):
"""Build list of category redirect templates."""
--
To view, visit
https://gerrit.wikimedia.org/r/378654
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id94bf466063a58bf6311e6a84128f854d09c19d1
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>