Revision: 5559 Author: russblau Date: 2008-06-11 20:27:31 +0000 (Wed, 11 Jun 2008)
Log Message: ----------- fix limit bug in QueryGenerator
Modified Paths: -------------- branches/rewrite/pywikibot/data/api.py
Modified: branches/rewrite/pywikibot/data/api.py =================================================================== --- branches/rewrite/pywikibot/data/api.py 2008-06-11 19:45:15 UTC (rev 5558) +++ branches/rewrite/pywikibot/data/api.py 2008-06-11 20:27:31 UTC (rev 5559) @@ -358,6 +358,9 @@ logging.debug(self.data) return pagedata = self.data["query"][self.resultkey] + logging.debug("%s received %s; limit=%s" + % (self.__class__.__name__, pagedata.keys(), + self.limit)) if isinstance(pagedata, dict): pagedata = pagedata.values() # for generators, this yields the pages in order of @@ -366,7 +369,8 @@ for item in pagedata: yield self.result(item) count += 1 - if self.limit is not None and count >= self.limit: + if self.limit is not None and self.limit > 0 \ + and count >= self.limit: return if not "query-continue" in self.data: return