http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11360
Revision: 11360 Author: legoktm Date: 2013-04-08 13:22:36 +0000 (Mon, 08 Apr 2013) Log Message: ----------- Add support for removing claims
Modified Paths: -------------- branches/rewrite/pywikibot/page.py branches/rewrite/pywikibot/site.py
Modified: branches/rewrite/pywikibot/page.py =================================================================== --- branches/rewrite/pywikibot/page.py 2013-04-08 12:57:36 UTC (rev 11359) +++ branches/rewrite/pywikibot/page.py 2013-04-08 13:22:36 UTC (rev 11360) @@ -2506,7 +2506,14 @@ """ self.repo.addClaim(self, claim, bot=bot)
+ def removeClaims(self, claims, **kwargs): + """ + Removes the claims from the item + @type claims: list + """ + self.repo.removeClaims(claims, **kwargs)
+ class PropertyPage(WikibasePage): """ Any page in the property namespace
Modified: branches/rewrite/pywikibot/site.py =================================================================== --- branches/rewrite/pywikibot/site.py 2013-04-08 12:57:36 UTC (rev 11359) +++ branches/rewrite/pywikibot/site.py 2013-04-08 13:22:36 UTC (rev 11360) @@ -3473,9 +3473,17 @@ data = req.submit() return data
+ def removeClaims(self, claims, **kwargs): + params = dict(action='wbremoveclaims') + params['claim'] = '|'.join(claim.snak for claim in claims) + params['token'] = self.token(pywikibot.Page(self, u'Main Page'), 'edit') # Use a dummy page + for kwarg in kwargs: + if kwarg in ['bot', 'baserevid']: + params[kwarg] = kwargs[kwarg] + req = api.Request(site=self, **params) + data = req.submit() + return data
- - # deprecated BaseSite methods def fam(self): raise NotImplementedError
pywikipedia-svn@lists.wikimedia.org