jenkins-bot has submitted this change and it was merged.
Change subject: Correctly identify qualifier from JSON
......................................................................
Correctly identify qualifier from JSON
Identifies any qualifier or reference if initialised through fromJSON()
on parent claim
Bug: T113212
Change-Id: I7255cf50b21bac19f44f152ddd4a189825dd7eab
---
M pywikibot/page.py
1 file changed, 6 insertions(+), 6 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 97c881c..a6069c1 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -4055,7 +4055,7 @@
"""
A Claim on a Wikibase entity.
- Claims are standard claims as well as references.
+ Claims are standard claims as well as references and qualifiers.
"""
TARGET_CONVERTER = {
@@ -4114,10 +4114,7 @@
if 'id' in data:
claim.snak = data['id']
elif 'hash' in data:
- claim.isReference = True
claim.hash = data['hash']
- else:
- claim.isQualifier = True
claim.snaktype = data['mainsnak']['snaktype']
if claim.getSnakType() == 'value':
value = data['mainsnak']['datavalue']['value']
@@ -4159,6 +4156,7 @@
for claimsnak in data['snaks'][prop]:
claim = cls.fromJSON(site, {'mainsnak': claimsnak,
'hash': data['hash']})
+ claim.isReference = True
if claim.getID() not in source:
source[claim.getID()] = []
source[claim.getID()].append(claim)
@@ -4175,8 +4173,10 @@
@return: Claim
"""
- return cls.fromJSON(site, {'mainsnak': data,
- 'hash': data['hash']})
+ claim = cls.fromJSON(site, {'mainsnak': data,
+ 'hash': data['hash']})
+ claim.isQualifier = True
+ return claim
def toJSON(self):
"""
--
To view, visit
https://gerrit.wikimedia.org/r/239780
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7255cf50b21bac19f44f152ddd4a189825dd7eab
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Lokal Profil <lokal.profil(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Lokal Profil <lokal.profil(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>