jenkins-bot has submitted this change and it was merged.
Change subject: (bug 66466) Exception getting edit token for Claim ......................................................................
(bug 66466) Exception getting edit token for Claim
Site.editSource and other Claim modification methods fetched an edit token using the claim itself as 'page', which was previously the Property:Pxx page.
Due to Id63969c045ac63a5b0276f696ce5797c4ee8b6df, Claim objects are no longer a Page, and these methods need to select a page for which to fetch the token.
Standard practise is to use 'Main Page' to fetch an edit token, which is what this changeset does.
Change-Id: Ic7f8308438c910e5b4ce798a36a1e6e5d77c4a96 --- M pywikibot/site.py 1 file changed, 8 insertions(+), 4 deletions(-)
Approvals: John Vandenberg: Verified; Looks good to me, approved JAn Dudík: Looks good to me, but someone else must approve jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py index 578febf..e3ad6cc 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -3752,7 +3752,8 @@ params['value'] = json.dumps(claim._formatDataValue()) if 'summary' in kwargs: params['summary'] = kwargs['summary'] - params['token'] = self.token(item, 'edit') + params['token'] = self.token(pywikibot.Page(self, u'Main Page'), + 'edit') req = api.Request(site=self, **params) data = req.submit() claim.snak = data['claim']['id'] @@ -3782,7 +3783,8 @@ params['bot'] = 1 if 'summary' in kwargs: params['summary'] = kwargs['summary'] - params['token'] = self.token(claim, 'edit') + params['token'] = self.token(pywikibot.Page(self, u'Main Page'), + 'edit') if snaktype == 'value': params['value'] = json.dumps(claim._formatDataValue())
@@ -3811,7 +3813,8 @@ params['baserevid'] = claim.on_item.lastrevid if bot: params['bot'] = 1 - params['token'] = self.token(claim, 'edit') + params['token'] = self.token(pywikibot.Page(self, u'Main Page'), + 'edit') # build up the snak if isinstance(source, list): sources = source @@ -3881,7 +3884,8 @@ hasattr(qualifier, 'hash') and qualifier.hash is not None): params['snakhash'] = qualifier.hash - params['token'] = self.token(claim, 'edit') + params['token'] = self.token(pywikibot.Page(self, u'Main Page'), + 'edit') # build up the snak if qualifier.getSnakType() == 'value': params['value'] = json.dumps(qualifier._formatDataValue())