Revision: 4951 Author: rotem Date: 2008-01-30 16:57:52 +0000 (Wed, 30 Jan 2008)
Log Message: ----------- (bug 1882680) Avoid double-parsing of the namespace in Special:Allpages: Parse namespace only if no namespace is mentioned.
Modified Paths: -------------- trunk/pywikipedia/pagegenerators.py
Modified: trunk/pywikipedia/pagegenerators.py =================================================================== --- trunk/pywikipedia/pagegenerators.py 2008-01-30 15:48:24 UTC (rev 4950) +++ trunk/pywikipedia/pagegenerators.py 2008-01-30 16:57:52 UTC (rev 4951) @@ -129,11 +129,11 @@ """ if site is None: site = wikipedia.getSite() - page = wikipedia.Page(site, start) if namespace is None: + page = wikipedia.Page(site, start) namespace = page.namespace() - title = page.titleWithoutNamespace() - for page in site.allpages(start = title, namespace = namespace, includeredirects = includeredirects): + start = page.titleWithoutNamespace() + for page in site.allpages(start = start, namespace = namespace, includeredirects = includeredirects): yield page
def PrefixingPageGenerator(prefix, namespace = None, includeredirects = True, site = None):