Revision: 6693 Author: nicdumz Date: 2009-04-24 06:31:34 +0000 (Fri, 24 Apr 2009)
Log Message: ----------- PageTree.remove -> PageTree.removeSite And now that remove() is only used once to remove all pages from a single site, use removeSite instead.
Modified Paths: -------------- trunk/pywikipedia/interwiki.py
Modified: trunk/pywikipedia/interwiki.py =================================================================== --- trunk/pywikipedia/interwiki.py 2009-04-24 06:26:16 UTC (rev 6692) +++ trunk/pywikipedia/interwiki.py 2009-04-24 06:31:34 UTC (rev 6693) @@ -531,9 +531,15 @@ self.tree[site][page] = True self.size += 1
- def remove(self, page): - del self.tree[site][page] - self.size -= 1 + def removeSite(self, site): + """ + Removes all pages from Site site + """ + try: + self.size -= len(self.tree[site]) + del self.tree[site] + except KeyError: + pass
def siteCounts(self): """ @@ -669,8 +675,8 @@ for page in self.todo.filter(site): self.pending.add(page) result.append(page) - for page in self.pending.filter(site): - self.todo.remove(page) + + self.todo.removeSite(site) # If there are any, return them. Otherwise, nothing is in progress. return result
pywikipedia-svn@lists.wikimedia.org