Page MenuHomePhabricator

Partial caching in subcategories() leads to incomplete data in subsequent calls
Closed, ResolvedPublicBUG REPORT

Description

import pywikibot

site = pywikibot.Site('en', 'wikipedia')
cat = pywikibot.Category(site, "Category:French writers")

cats = cat.subcategories(total=3)
for c in enumerate(cats): print c

cats1 = cat.subcategories()
for c in enumerate(cats1): print c

gives:
(0, Category(Category:French Guianan writers))
(1, Category(Category:French Polynesian writers))
(2, Category(Category:Guadeloupean writers))

(0, Category(Category:French Guianan writers))
(1, Category(Category:French Polynesian writers))
(2, Category(Category:Guadeloupean writers))

while the category has 26 subcategories instead.

Event Timeline

Mpaa raised the priority of this task from to Needs Triage.
Mpaa updated the task description. (Show Details)
Mpaa added a project: Pywikibot.
Mpaa subscribed.
Restricted Application added subscribers: Aklapper, Unknown Object (MLST). · View Herald TranscriptJan 31 2015, 4:51 PM

There is also a lot of repetition in members(), articles() and subcategories().
There should be one general function and the others two defined in terms of the general one.

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

[pywikibot/core@master] [bugfix]: fix partial caching in Category.subcategories()

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

Xqt triaged this task as High priority.
Xqt changed the subtype of this task from "Task" to "Bug Report".

Change 818135 merged by jenkins-bot:

[pywikibot/core@master] [bugfix]: fix partial caching in Category.subcategories()

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