Page MenuHomePhabricator

flow.Board.topics continuation breaks when reverse=True
Open, HighPublic

Description

When using board.topics(reverse=True), after the first batch has been iterated (default is 100 topics), the generator fails with KeyError.

from pywikibot.flow import Board
site = pywikibot.Site('mediawiki', 'mediawiki')
board = Board(site, 'Project talk:Sandbox/Flow test')
topics_list = board.topics(reverse=True)
for topic in topics_list:
    print(topic)

results in

[[mediawiki:Topic:Sojpiv245cuiw67c]]
[[mediawiki:Topic:Sofvr5snmpjxk7po]]
[[mediawiki:Topic:Sofvkmr22vxpo1x4]]
[[mediawiki:Topic:Socee2qdhcihhfaf]]
[[mediawiki:Topic:So9nobp64639g1l8]]
[[mediawiki:Topic:So6onix7tg6u22y0]]
[[mediawiki:Topic:So2r9kvmvvmo32to]]
[[mediawiki:Topic:So1soxbq2h0ju3uz]]
...
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "pywikibot/flow.py", line 139, in topics
    cont_args = self._parse_url(data['links']['pagination'])
  File "pywikibot/flow.py", line 93, in _parse_url
    rule = links['fwd']
KeyError: u'fwd'

Event Timeline

jayvdb created this task.Jun 21 2016, 4:45 PM
Restricted Application added subscribers: pywikibot-bugs-list, Zppix, Aklapper. · View Herald TranscriptJun 21 2016, 4:45 PM

This was a remarkably simple oversight on my part. When the topic list is reversed, the proper key is "rev" rather than "fwd".

happy5214 triaged this task as High priority.May 31 2017, 12:30 AM