http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11686
Revision: 11686 Author: legoktm Date: 2013-06-21 21:36:43 +0000 (Fri, 21 Jun 2013) Log Message: ----------- If the standard '*' message isn't available, use the 'html' one. Caused by [[bugzilla:49978]].
Modified Paths: -------------- branches/rewrite/pywikibot/data/api.py
Modified: branches/rewrite/pywikibot/data/api.py =================================================================== --- branches/rewrite/pywikibot/data/api.py 2013-06-21 20:26:56 UTC (rev 11685) +++ branches/rewrite/pywikibot/data/api.py 2013-06-21 21:36:43 UTC (rev 11686) @@ -355,9 +355,18 @@ if "warnings" in result: modules = [k for k in result["warnings"] if k != "info"] for mod in modules: + if '*' in result["warnings"][mod]: + text = result["warnings"][mod]['*'] + elif 'html' in result["warnings"][mod]: + # Bugzilla 49978 + text = result["warnings"][mod]['html']['*'] + else: + # This is just a warning, we shouldn't raise an + # exception because of it + continue pywikibot.warning( u"API warning (%s): %s" - % (mod, result["warnings"][mod]["*"])) + % (mod, text)) if "error" not in result: return result if "*" in result["error"]:
pywikipedia-svn@lists.wikimedia.org