jenkins-bot has submitted this change and it was merged.
Change subject: Bug 60206 - site.preloadpages does not preload all links and templates ......................................................................
Bug 60206 - site.preloadpages does not preload all links and templates
page._langlinks and page._templates are extended in case chucks are returned by query due to query-continue
Change-Id: Ib87ff56c18d17dbc189f57215e3cfa14a323b3e2 --- M pywikibot/data/api.py 1 file changed, 11 insertions(+), 3 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py index 1dbd5ac..a502d35 100644 --- a/pywikibot/data/api.py +++ b/pywikibot/data/api.py @@ -984,8 +984,12 @@ page._catinfo = pagedict["categoryinfo"]
if "templates" in pagedict: - page._templates = [pywikibot.Page(page.site, tl['title']) - for tl in pagedict['templates']] + templates = [pywikibot.Page(page.site, tl['title']) + for tl in pagedict['templates']] + if hasattr(page, "_templates"): + page._templates.extend(templates) + else: + page._templates = templates
if "langlinks" in pagedict: links = [] @@ -994,7 +998,11 @@ ll['*'], source=page.site) links.append(link) - page._langlinks = links + + if hasattr(page, "_langlinks"): + page._langlinks.extend(links) + else: + page._langlinks = links
if "coordinates" in pagedict: coords = []
pywikibot-commits@lists.wikimedia.org