Page MenuHomePhabricator

Pywikibot should have a wikibase-error-sitelink-already-used exception
Open, HighPublic

Description

At the moment when you try to add a sitelink to an item at Wikidata that's already used, you'll get a pywikibot.data.api.APIError.

Sitelink to Commons Category:Mormonism based on P373
failed-save
Site link [commons.wikimedia.org/wiki/Category:Mormonism Category:Mormonism] is already used by item [[Q8808767]]. Perhaps the items should be [[Help:Merge|merged]] and one of them [[Wikidata:Deletion policy|deleted]]? Request deletion of one of the items at [[Wikidata:Requests for deletion]], or ask at [[Wikidata:Interwiki conflicts]] if you believe that they should not be merged.
{u'messages': {u'0': {u'type': u'error', u'name': u'wikibase-error-sitelink-already-used', u'parameters': [u'
commons.wikimedia.org/wiki/Category:Mormonism', u'Category:Mormonism', u'Q8808767', u'commonswiki']}, u'html': {u'*': u'<p>Site link <a class="external text" href="//commons.wikimedia.org/wiki/Category:Mormonism">Category:Mormonism</a> is already used by item <a href="/wiki/Q8808767" title="Q8808767">Q8808767</a>. Perhaps the items should be <a href="/wiki/Help:Merge" title="Help:Merge">merged</a> and one of them <a href="/wiki/Wikidata:Deletion_policy" title="Wikidata:Deletion policy">deleted</a>? Request deletion of one of the items at <a href="/wiki/Wikidata:Requests_for_deletion" title="Wikidata:Requests for deletion" class="mw-redirect">Wikidata:Requests for deletion</a>, or ask at <a href="/wiki/Wikidata:Interwiki_conflicts" title="Wikidata:Interwiki conflicts">Wikidata:Interwiki conflicts</a> if you believe that they should not be merged.\n</p>'}}}

This is a bit too low level for me. This should be caught by either site or page and a WikiBase exception should be thrown.

The behavior should probably be modeled after the IsRedirectPage exception. We might want to create some more Wikibase exceptions while we're at it, but I haven't looked into that.
PageRelatedError


Version: core-(2.0)
Severity: major

Details

Reference
bz59973

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:40 AM
bzimport set Reference to bz59973.
bzimport added a subscriber: Unknown Object (????).
jayvdb moved this task from Backlog to Framework on the Pywikibot-Wikidata board.Nov 30 2014, 12:10 PM