Last modified: 2014-05-25 17:15:15 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).
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
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.
works with aliases set to [""] instead of just []. i still think it's confusing, but it works.