Revision: 6354 Author: russblau Date: 2009-02-16 22:16:53 +0000 (Mon, 16 Feb 2009)
Log Message: ----------- restore component-specific debugging
Modified Paths: -------------- branches/rewrite/pywikibot/data/api.py
Modified: branches/rewrite/pywikibot/data/api.py =================================================================== --- branches/rewrite/pywikibot/data/api.py 2009-02-14 14:36:27 UTC (rev 6353) +++ branches/rewrite/pywikibot/data/api.py 2009-02-16 22:16:53 UTC (rev 6354) @@ -200,8 +200,7 @@ level=pywikibot.VERBOSE) self.wait() continue - pywikibot.output("API response received:\n%s" % rawdata, - level=pywikibot.DEBUG) + logger.debug(u"API response received:\n%s" % rawdata) if not isinstance(rawdata, unicode): rawdata = rawdata.decode(self.site.encoding()) if rawdata.startswith(u"unknown_action"): @@ -214,7 +213,7 @@ pywikibot.output( "Non-JSON response received from server %s; the server may be down." % self.site, level=pywikibot.WARNING) - pywikibot.output(rawdata, level=pywikibot.DEBUG) + logger.debug(rawdata) self.wait() continue if not result: @@ -360,10 +359,9 @@ else: self.query_limit = int(param["max"]) self.prefix = _modules[mod]["prefix"] - pywikibot.output(u"%s: Set query_limit to %i." - % (self.__class__.__name__, - self.query_limit), - level=pywikibot.DEBUG) + logger.debug(u"%s: Set query_limit to %i." + % (self.__class__.__name__, + self.query_limit)) return
def __iter__(self): @@ -385,31 +383,26 @@ self.request[self.prefix+"limit"] = str(new_limit) self.data = self.request.submit() if not self.data or not isinstance(self.data, dict): - pywikibot.output( + logger.debug( u"%s: stopped iteration because no dict retrieved from api." - % self.__class__.__name__, - level=pywikibot.DEBUG) + % self.__class__.__name__) return if not ("query" in self.data and self.resultkey in self.data["query"]): - pywikibot.output( + logger.debug( u"%s: stopped iteration because 'query' and '%s' not found in api response." - % (self.__class__.__name__, self.resultkey), - level=pywikibot.DEBUG) - pywikibot.output(unicode(self.data), level=pywikibot.DEBUG) + % (self.__class__.__name__, self.resultkey)) + logger.debug(unicode(self.data)) return pagedata = self.data["query"][self.resultkey] if isinstance(pagedata, dict): - pywikibot.output(u"%s received %s; limit=%s" - % (self.__class__.__name__, pagedata.keys(), - self.limit), - level=pywikibot.DEBUG) + logger.debug(u"%s received %s; limit=%s" + % (self.__class__.__name__, pagedata.keys(), + self.limit)) pagedata = pagedata.values() else: - pywikibot.output(u"%s received %s; limit=%s" - % (self.__class__.__name__, pagedata, - self.limit), - level=pywikibot.DEBUG) + logger.debug(u"%s received %s; limit=%s" + % (self.__class__.__name__, pagedata, self.limit)) for item in pagedata: yield self.result(item) count += 1