Xqt has uploaded a new change for review.
https://gerrit.wikimedia.org/r/233218
Change subject: [IMPR] Don't raise KeyError in _params propery.
......................................................................
[IMPR] Don't raise KeyError in _params propery.
- Remove a kind of code duplication. A similar exception will 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(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/18/233218/1
diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py
index 11f1d73..cadad09 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: newchange
Gerrit-Change-Id: I4a40cf543c716fb81126a67cfdc2f00bef201381
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits