Revision: 4655 Author: filnik Date: 2007-12-09 13:25:52 +0000 (Sun, 09 Dec 2007)
Log Message: ----------- Bugfix (if repeat is not used it returns only one image)
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2007-12-09 13:23:16 UTC (rev 4654) +++ trunk/pywikipedia/wikipedia.py 2007-12-09 13:25:52 UTC (rev 4655) @@ -4227,21 +4227,22 @@ re.UNICODE) pos = 0 seen = list() - ext_list = list() - for m in regexp.finditer(html): - new = m.group('new') - im = m.group('image') - ext = m.group('ext') - # This prevent pages with strange characters. They will be loaded without problem. - image = "%s.%s" % (im, ext) - if new != '': - output(u"Skipping %s because it has been deleted." % image) + ext_list = list() + while True: + for m in regexp.finditer(html): + new = m.group('new') + im = m.group('image') + ext = m.group('ext') + # This prevent pages with strange characters. They will be loaded without problem. + image = "%s.%s" % (im, ext) + if new != '': + output(u"Skipping %s because it has been deleted." % image) + if image not in seen: + seen.append(image) if image not in seen: seen.append(image) - if image not in seen: - seen.append(image) - page = Page(self, 'Image:%s' % image) - yield page + page = Page(self, 'Image:%s' % image) + yield page if not repeat: output(u"\t\t>> All images checked. <<") break
pywikipedia-l@lists.wikimedia.org