Page MenuHomePhabricator

Board.topics does not respect limit argument
Open, HighPublic

Description

As first encountered on T138215, Board.topics does not respect the limit argument.

from pywikibot.flow import Board
site = pywikibot.Site('test', 'test')
board = Board(site, 'Talk:Sandbox')
topics_list = board.topics(limit=2)
for topic in topics_list:
    print(topic)

returns an unlimited list, except that it fails midway with T138306: Broken topics on mediawiki.org and test wiki that the API doesnt believe exists:

[[test:Topic:T63mvwp0c7chy9c3]]
[[test:Topic:T5y39gw54bnw2ice]]
[[test:Topic:T40a7hu3rdj1w3kv]]
[[test:Topic:T2d0esp9nk0tvt2z]]
[[test:Topic:T2d0bc2kfgj5z7d2]]
...

Event Timeline

jayvdb created this task.Jun 21 2016, 2:18 PM
Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptJun 21 2016, 2:18 PM
jayvdb updated the task description. (Show Details)Jun 21 2016, 2:19 PM
jayvdb updated the task description. (Show Details)Jun 21 2016, 3:45 PM

The method is a generator. The limit parameter simply gets passed to the API as a per-query limit. It has no effect on how many topics the generator will eventually return. It's more of a design issue than a usual bug.