https://bugzilla.wikimedia.org/show_bug.cgi?id=54415

--- Comment #1 from Kunal Mehta (Legoktm) <[email protected]> ---
slightly improved version, merged with the new "source" function



:::python

            for claim in self.claims:
                if claim.getID() in item.get().get('claims'):
                    for existingclaimwithproperty in item.claims[claim]:
                        if existingclaimwithproperty.getTarget() ==
claim.getTarget():
                            pywikibot.output("item for %s has already property
%s with value %s" % (page.title(), claim,
existingclaimwithproperty.getTarget()))
                            break
                        else:
                            continue
                    else:
                        pywikibot.output('Adding additional %s --> %s' %
(claim.getID(), claim.getTarget()))
                        item.addClaim(claim)
                        source = self.getSource(page.site.language())
                        if self.source:
                            claim.addSource(self.source, bot=True)
                            # TODO FIXME: We need to check that we aren't
adding a
                            # duplicate source

                else:
                    pywikibot.output('Adding %s --> %s'
                                     % (claim.getID(), claim.getTarget()))
                    item.addClaim(claim)
                    source = self.getSource(page.site.language())
                    if self.source:
                        claim.addSource(self.source, bot=True)
                    # TODO FIXME: We need to check that we aren't adding a
                    # duplicate source

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to