jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/289227 )
Change subject: [IMPR] Show a warning when a LogEntry type is not known ......................................................................
[IMPR] Show a warning when a LogEntry type is not known
- a warning could ensure to update the bot for unknown types - put the return statement outside the try statement to ensure that only the missing 'type' key is fetched by this exception
Bug: T135505 Change-Id: I096cf636c6da1d65fe578e053594a5203d4dceb8 --- M pywikibot/logentries.py 1 file changed, 4 insertions(+), 2 deletions(-)
Approvals: Mpaa: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py index 7665806..310d826 100644 --- a/pywikibot/logentries.py +++ b/pywikibot/logentries.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Objects representing Mediawiki log entries.""" # -# (C) Pywikibot team, 2007-2016 +# (C) Pywikibot team, 2007-2017 # # Distributed under the terms of the MIT license. # @@ -431,6 +431,8 @@ try: return cls.logtypes[logtype] except KeyError: + pywikibot.warning( + 'Log entry key {0} is not known.'.format(logtype)) return LogEntry
def _createFromData(self, logdata): @@ -443,8 +445,8 @@ """ try: logtype = logdata['type'] - return LogEntryFactory._getEntryClass(logtype)(logdata, self._site) except KeyError: pywikibot.debug('API log entry received:\n{0}'.format(logdata), _logger) raise Error("Log entry has no 'type' key") + return LogEntryFactory._getEntryClass(logtype)(logdata, self._site)
pywikibot-commits@lists.wikimedia.org