Page MenuHomePhabricator

Check Pywikibot for new Wikibase empty container format
Closed, ResolvedPublic

Description

The output format in the Wikibase api will change for empty containers, see T138104 . Used to be [] and it's going to be {}. Check if Pywikibot doesn't horribly choke and burn because of this. New item: https://www.wikidata.org/wiki/Special:EntityData/Q24075199.json . On the live site you can find empty items on https://www.wikidata.org/wiki/Special:ShortPages .

Event Timeline

Xqt triaged this task as Medium priority.Apr 2 2019, 5:43 PM

It seems Pywikibot has assumed these are always dicts. Just because the containers were empty it didn't fail:

pywikibot/page.py
# aliases
self.aliases = {}
if 'aliases' in self._content:
  for lang in self._content['aliases']:
    self.aliases[lang] = []
    for value in self._content['aliases'][lang]:
      self.aliases[lang].append(value['value'])

# labels
self.labels = {}
if 'labels' in self._content:
  for lang in self._content['labels']:
    if 'removed' not in self._content['labels'][lang]:  # T56767
      self.labels[lang] = self._content['labels'][lang]['value']

# descriptions
self.descriptions = {}
if 'descriptions' in self._content:
  for lang in self._content['descriptions']:
    self.descriptions[lang] = self._content[
      'descriptions'][lang]['value']

Not actually tested yet.