Revision: 6668 Author: nicdumz Date: 2009-04-22 15:24:54 +0000 (Wed, 22 Apr 2009)
Log Message: ----------- Don't generate completely a list if we only need the first element
Modified Paths: -------------- trunk/pywikipedia/interwiki.py
Modified: trunk/pywikipedia/interwiki.py =================================================================== --- trunk/pywikipedia/interwiki.py 2009-04-22 14:28:01 UTC (rev 6667) +++ trunk/pywikipedia/interwiki.py 2009-04-22 15:24:54 UTC (rev 6668) @@ -893,7 +893,12 @@ # Ignore the interwiki links. iw = () elif globalvar.autonomous and page.site() in [p.site() for p in self.done if p != page and p.exists() and not p.isRedirectPage()]: - otherpage = [p for p in self.done if p.site() == page.site() and p != page and p.exists() and not p.isRedirectPage()][0] + + for p in self.done: + if p.site() == page.site() and p != page \ + and p.exists() and not p.isRedirectPage(): + otherpage = p + break wikipedia.output(u"Stopping work on %s because duplicate pages %s and %s are found"%(self.originPage.aslink(),otherpage.aslink(True),page.aslink(True))) self.makeForcedStop(counter) try:
pywikipedia-svn@lists.wikimedia.org