http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11730
Revision: 11730 Author: legoktm Date: 2013-07-08 16:52:06 +0000 (Mon, 08 Jul 2013) Log Message: ----------- Restructure qualifiers to be stored in a dictionary, like claims are stored in ItemPage.
Modified Paths: -------------- branches/rewrite/pywikibot/page.py
Modified: branches/rewrite/pywikibot/page.py =================================================================== --- branches/rewrite/pywikibot/page.py 2013-07-08 09:12:38 UTC (rev 11729) +++ branches/rewrite/pywikibot/page.py 2013-07-08 16:52:06 UTC (rev 11730) @@ -2641,7 +2641,7 @@ if self.isQualifier and self.isReference: raise ValueError(u'Claim cannot be both a qualifier and reference.') self.sources = [] - self.qualifiers = [] + self.qualifiers = {} self.target = None self.snaktype = 'value' self.on_item = None # The item it's on @@ -2679,7 +2679,11 @@ if 'qualifiers' in data: for prop in data['qualifiers']: for qualifier in data['qualifiers'][prop]: - claim.qualifiers.append(Claim.qualifierFromJSON(site, qualifier)) + qual = Claim.qualifierFromJSON(site, qualifier) + if prop in claim.qualifiers: + claim.qualifiers[prop].append(qual) + else: + claim.qualifiers[prop] = [qual] return claim
@staticmethod