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

Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptApr 2 2019, 4:06 PM
Xqt triaged this task as Normal priority.Apr 2 2019, 5:43 PM
matej_suchanek added a subscriber: matej_suchanek.EditedApr 2 2019, 8:44 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.

matej_suchanek closed this task as Resolved.May 11 2019, 8:35 AM
matej_suchanek claimed this task.