HomePhabricator

Do not crash on grouping items without an English label

Tags
None
Referenced Files
None
Subscribers
None

Description

Do not crash on grouping items without an English label

When grouping_link is used, integraality looks up the
English label of each grouping item to build the link
(which is debatable, and under re-consideration at T237276)

However, this fails if the item has no English label (with [1]).

Let's just catch the KeyError, and agree to revisit
the whole label idea with T237276.

Also add some info-level logging of the issue.

[1] Stacktrace:

  File "./integraality/property_statistics.py", line 681, in <module>
    main()
  File "./integraality/property_statistics.py", line 677, in main
    print(stats.retrieve_and_process_data())
  File "./integraality/property_statistics.py", line 619, in retrieve_and_process_data
    text += self.make_stats_for_one_grouping(grouping, item_count, higher_grouping)
  File "./integraality/property_statistics.py", line 546, in make_stats_for_one_grouping
    label = group_item.labels["en"]
  File "/usr/local/lib/python3.7/site-packages/pywikibot/page/_collections.py", line 46, in __getitem__
    return self._data[key]
KeyError: 'en'

Bug: T283287

Details

Provenance
JeanFredAuthored on May 20 2021, 8:46 PM
Parents
R2566:344bb30808bf: Pass wiki as argument to run Shell script
Branches
Unknown
Tags
Unknown
ChangeId
None