Page MenuHomePhabricator

Page.revisions ignores starttime when revisions have been cached
Closed, ResolvedPublic

Description

When using Page.revisions the starttime parameter is ignored when revisions have been already requested. Creating a new Page instance or clearing the cache (p._revisions.clear()) helps then.

>>> import pywikibot
>>> s = pywikibot.Site('wikidata', 'wikidata')
>>> s = s.data_repository()
>>> p = pywikibot.ItemPage(s, 'Q4159897')
>>> p.revisions(total=1)
<generator object <genexpr> at 0x7f31f83d9af8>
>>> list(p.revisions(total=1))
[{'minor': False, 'anon': False, 'timestamp': Timestamp(2015, 8, 15, 14, 26, 32), 'rollbacktoken': None, 'text': None, 'user': 'Илья Драконов', '_parent_id': 160539148, 'revid': 241825713, '_content_model': None, 'comment': '/* wbsetsitelink-add:1|enwiki */ Dzhankoy Railway station', '_sha1': None}]
>>> list(p.revisions(total=1, starttime='2015-08-14T10:26:32Z'))
[{'minor': False, 'anon': False, 'timestamp': Timestamp(2015, 8, 15, 14, 26, 32), 'rollbacktoken': None, 'text': None, 'user': 'Илья Драконов', '_parent_id': 160539148, 'revid': 241825713, '_content_model': None, 'comment': '/* wbsetsitelink-add:1|enwiki */ Dzhankoy Railway station', '_sha1': None}]
>>> p = pywikibot.ItemPage(s, 'Q4159897')
>>> list(p.revisions(total=1, starttime='2015-08-14T10:26:32Z'))
[{'minor': False, 'anon': False, 'timestamp': Timestamp(2014, 9, 29, 16, 43, 46), 'rollbacktoken': None, 'text': None, 'user': 'Michael1238', '_parent_id': 160539089, 'revid': 160539148, '_content_model': None, 'comment': '/* wbsetclaim-update:2||1 */ [[Property:P137]]: [[Q660770]]', '_sha1': None}]

Details

Event Timeline

XZise raised the priority of this task from to Needs Triage.
XZise updated the task description. (Show Details)
XZise added a project: Pywikibot.
XZise subscribed.

Change 779948 had a related patch set uploaded (by Mpaa; author: Mpaa):

[pywikibot/core@master] [bugfix]: fix Page.revisions() with starttime

https://gerrit.wikimedia.org/r/779948

Xqt triaged this task as High priority.Apr 14 2022, 1:15 PM

Change 779948 merged by Xqt:

[pywikibot/core@master] [bugfix]: fix Page.revisions() with starttime

https://gerrit.wikimedia.org/r/779948