http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11373
Revision: 11373 Author: multichill Date: 2013-04-16 18:54:08 +0000 (Tue, 16 Apr 2013) Log Message: ----------- Added crude dupe checking so we're not causing a big mess.
Modified Paths: -------------- branches/rewrite/scripts/claimit.py
Modified: branches/rewrite/scripts/claimit.py =================================================================== --- branches/rewrite/scripts/claimit.py 2013-04-16 18:22:45 UTC (rev 11372) +++ branches/rewrite/scripts/claimit.py 2013-04-16 18:54:08 UTC (rev 11373) @@ -30,10 +30,14 @@ return False
for claim in claims: - pywikibot.output('Adding %s --> %s' % (claim.getID(), claim.getTarget().getID())) - item.addClaim(claim) - #TODO FIXME: We should add a source for each claim that is added - #TODO FIXME: We need to check that we aren't adding a duplicate + if claim.getID() in item.get().get('claims'): + pywikibot.output(u'A claim for %s already exists. Skipping' % (claim.getID(),)) + #TODO FIXME: This is a very crude way of dupe checking + else: + pywikibot.output('Adding %s --> %s' % (claim.getID(), claim.getTarget().getID())) + item.addClaim(claim) + #TODO FIXME: We should add a source for each claim that is added + #TODO FIXME: We need to check that we aren't adding a duplicate
def main(): @@ -52,7 +56,6 @@ claim.setTarget(pywikibot.ItemPage(repo, commandline_claims[i+1])) claims.append(claim)
- generator = gen.getCombinedGenerator()
if generator:
pywikipedia-svn@lists.wikimedia.org