http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11267
Revision: 11267 Author: legoktm Date: 2013-03-25 14:19:36 +0000 (Mon, 25 Mar 2013) Log Message: ----------- Have CategorizedPageGenerator implement sortkey with API
Modified Paths: -------------- branches/rewrite/pywikibot/pagegenerators.py
Modified: branches/rewrite/pywikibot/pagegenerators.py =================================================================== --- branches/rewrite/pywikibot/pagegenerators.py 2013-03-25 13:50:12 UTC (rev 11266) +++ branches/rewrite/pywikibot/pagegenerators.py 2013-03-25 14:19:36 UTC (rev 11267) @@ -604,11 +604,16 @@ retrieved page will be downloaded.
""" - # TODO: page generator could be modified to use cmstartsortkey ... - for a in category.articles( - recurse=recurse, step=step, total=total, content=content): - if start is None or a.title(withNamespace=False) >= start: - yield a + kwargs = dict(recurse=recurse, + step=step, + total=total, + content=content, + ) + if start: + kwargs['sortby'] = 'sortkey' + kwargs['startsort'] = start + for a in category.site.categorymembers(category, **kwargs): + yield a
def SubCategoriesPageGenerator(category, recurse=False, start=None,
pywikipedia-svn@lists.wikimedia.org