Last modified: 2014-05-25 17:15:15 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T66496, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 64496 - remove aliases with editAliases()
remove aliases with editAliases()
Status: RESOLVED FIXED
Product: Pywikibot
Classification: Unclassified
Wikidata (Other open bugs)
core-(2.0)
All All
: Unprioritized normal
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-27 08:06 UTC by akkakk_bugzilla
Modified: 2014-05-25 17:15 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description akkakk_bugzilla 2014-04-27 08:06:48 UTC
editLabels and editDescriptions remove labels/descriptions when they are set to "" (empty string). editAliases should do the same when aliases are set to [] (empty list).
Comment 1 akkakk_bugzilla 2014-04-27 21:17:04 UTC
code to (not) reproduce:

#!/usr/bin/python
# -*- coding: utf-8 -*-
import pywikibot
site = pywikibot.Site("wikidata", "wikidata")
repo = site.data_repository()
q = "Q292753"
item_obj = pywikibot.ItemPage(repo, q)
content = item_obj.get()
aliases = content['aliases']
aliases['als'] = []
item_obj.editAliases(summary=u"remove redundant aliases", aliases=aliases)
#Q292753 did not change
Comment 2 Ricordisamoa 2014-05-25 16:09:30 UTC
This is how the wbeditentity API works. wbsetaliases accepts a 'remove' argument that could fit your needs.

https://gerrit.wikimedia.org/r/125575/ automatically fills the aliases list with empty strings to reset them:

item_obj = pywikibot.ItemPage(repo, q)
item_obj.get()
item_obj.aliases['als'] = []
item_obj.editEntity(summary=u"remove redundant aliases")

A similar technique could be implemented in editAliases(), but that would be a breaking change. Or we could provide a 'remove' argument in the function itself.
Comment 3 akkakk_bugzilla 2014-05-25 17:15:15 UTC
works with aliases set to [""] instead of just [].
i still think it's confusing, but it works.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links