jenkins-bot has submitted this change and it was merged.
Change subject: [IMPR] Don't raise KeyError in _params property.
......................................................................
[IMPR] Don't raise KeyError in _params property.
- Remove a kind of code duplication. A similar exception will be raised by
__missing__ method of the LogDict dictionary.
- Remove empty flags for unblock action.
Change-Id: I4a40cf543c716fb81126a67cfdc2f00bef201381
---
M pywikibot/logentries.py
1 file changed, 3 insertions(+), 5 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py
index 452bf9d..1b1c376 100644
--- a/pywikibot/logentries.py
+++ b/pywikibot/logentries.py
@@ -69,11 +69,7 @@
if 'params' in self.data:
return self.data['params']
else: # try old mw style preceding mw 1.19
- try:
- return self.data[self._expectedType]
- except KeyError:
- raise Error("action='%s': this log entry has no params details
"
- "for type %s." % (self.action(), self.type))
+ return self.data[self._expectedType]
def logid(self):
"""Return the id of the log entry."""
@@ -177,6 +173,8 @@
@rtype: list of flag strings
"""
+ if self.action() == 'unblock':
+ return []
if not hasattr(self, '_flags'):
self._flags = self._params['flags']
# pre mw 1.19 returned a delimited string.
--
To view, visit https://gerrit.wikimedia.org/r/233218
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4a40cf543c716fb81126a67cfdc2f00bef201381
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Mpaa <[email protected]>
Gerrit-Reviewer: XZise <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits