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
(cherry picked from commit eb9d3a80b84c237740152b7ffd1957aacea6fb26)
---
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 3f4f1be..33bbace 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -3918,7 +3918,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 = {
@@ -3975,10 +3975,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']
@@ -4020,6 +4017,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)
@@ -4036,8 +4034,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):
data = {
--
To view, visit
https://gerrit.wikimedia.org/r/243043
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: 2.0
Gerrit-Owner: John Vandenberg <jayvdb(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 <>