Ricordisamoa has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/81156


Change subject: use **kwargs in ItemPage.addClaim to support edit summary
......................................................................

use **kwargs in ItemPage.addClaim to support edit summary

The Wikibase extension (used on Wikidata) has recently enabled the edit summary 
on entities; ItemPage.editEntity and Claim.addSource already support it, but 
ItemPage.addClaim doesn't.

Change-Id: Id70a0be601f603238c8eed817cc5fc58c4705c88
---
M pywikibot/page.py
M pywikibot/site.py
2 files changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/56/81156/1

diff --git a/pywikibot/page.py b/pywikibot/page.py
index 7956ae1..8816da2 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -2615,7 +2615,7 @@
         data = {'sitelinks': data}
         self.editEntity(data, **kwargs)
 
-    def addClaim(self, claim, bot=True):
+    def addClaim(self, claim, bot=True, **kwargs):
         """
         Adds the claim to the item
         @param claim The claim to add
@@ -2623,7 +2623,7 @@
         @param bot Whether to flag as bot (if possible)
         @type bot bool
         """
-        self.repo.addClaim(self, claim, bot=bot)
+        self.repo.addClaim(self, claim, bot=bot, **kwargs)
         claim.on_item = self
 
     def removeClaims(self, claims, **kwargs):
diff --git a/pywikibot/site.py b/pywikibot/site.py
index ef00047..e609d5e 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3439,7 +3439,7 @@
         return data
 
     @must_be(group='user')
-    def addClaim(self, item, claim, bot=True):
+    def addClaim(self, item, claim, bot=True, **kwargs):
 
         params = dict(action='wbcreateclaim',
                       entity=item.getID(),
@@ -3451,6 +3451,7 @@
             params['bot'] = 1
         if claim.getSnakType() == 'value':
             params['value'] = json.dumps(claim._formatDataValue())
+        params.update(kwargs)
         params['token'] = self.token(item, 'edit')
         req = api.Request(site=self, **params)
         data = req.submit()

-- 
To view, visit https://gerrit.wikimedia.org/r/81156
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id70a0be601f603238c8eed817cc5fc58c4705c88
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to