Revision: 6724
Author: nicdumz
Date: 2009-04-26 04:13:27 +0000 (Sun, 26 Apr 2009)
Log Message:
-----------
Fixing an IndexError in SearchPagesGenerator. (page[0] -> page)
Also changing other generators so they explicitely name the tuples
they receive from site methods, to avoid "page[0]" naming.
Modified Paths:
--------------
branches/rewrite/pywikibot/pagegenerators.py
Modified: branches/rewrite/pywikibot/pagegenerators.py
===================================================================
--- branches/rewrite/pywikibot/pagegenerators.py 2009-04-26 04:06:33 UTC (rev 6723)
+++ branches/rewrite/pywikibot/pagegenerators.py 2009-04-26 04:13:27 UTC (rev 6724)
@@ -700,8 +700,9 @@
def NewimagesPageGenerator(number = 100, repeat = False, site = None):
if site is None:
site = pywikibot.Site()
- for page in site.newimages(number, repeat=repeat):
- yield page[0]
+ for tuple in site.newimages(number, repeat=repeat):
+ # tuple is ImagePage, date, user comment
+ yield tuple[0]
def UnCategorizedPageGenerator(number = 100, repeat = False, site = None):
if site is None:
@@ -724,8 +725,8 @@
def AncientPagesPageGenerator(number = 100, repeat = False, site = None):
if site is None:
site = pywikibot.Site()
- for page in site.ancientpages(number=number, repeat=repeat):
- yield page[0]
+ for page, date in site.ancientpages(number=number, repeat=repeat):
+ yield page
def DeadendPagesPageGenerator(number = 100, repeat = False, site = None):
if site is None:
@@ -736,14 +737,14 @@
def LongPagesPageGenerator(number = 100, repeat = False, site = None):
if site is None:
site = pywikibot.Site()
- for page in site.longpages(number=number, repeat=repeat):
- yield page[0]
+ for page, length in site.longpages(number=number, repeat=repeat):
+ yield page
def ShortPagesPageGenerator(number = 100, repeat = False, site = None):
if site is None:
site = pywikibot.Site()
- for page in site.shortpages(number=number, repeat=repeat):
- yield page[0]
+ for page, length in site.shortpages(number=number, repeat=repeat):
+ yield page
def LinksearchPageGenerator(link, limit=None, site=None):
"""Yields all pages that include a specified link, according to
@@ -762,7 +763,7 @@
if site is None:
site = pywikibot.Site()
for page in site.search(query, number=number, namespaces = namespaces):
- yield page[0]
+ yield page
# following classes just ported from version 1 without revision; not tested