jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
api.py: buffer 'pageprops' in QueryGenerator

Currently, 'pageprops' is only cached if found in the response.
The API only returns this property if it's not empty, causing
repetitive queries if accessed multiple times.
This change caches 'pageprops' if it's requested, creating an
empty dictionary to use if it's not present in the response.

Change-Id: I30973b7479822ebc043f1d4db77522143e8c5652
---
M pywikibot/data/api.py
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index ff90b25..4c34108 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -3173,6 +3173,8 @@

if 'pageprops' in pagedict:
page._pageprops = pagedict['pageprops']
+ elif 'pageprops' in props:
+ page._pageprops = {}

if 'preload' in pagedict:
page._preloadedtext = pagedict['preload']

To view, visit change 237113. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I30973b7479822ebc043f1d4db77522143e8c5652
Gerrit-Change-Number: 237113
Gerrit-PatchSet: 7
Gerrit-Owner: Malafaya <malafaya@clix.pt>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Malafaya <malafaya@clix.pt>
Gerrit-Reviewer: Merlijn van Deen <valhallasw@arctus.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus@gmx.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged