Browse Source

Raise CountryListError if Page exists but no valid Single-Section exists

develop
Jonathan Golder 6 years ago
parent
commit
297adc62ec
1 changed files with 12 additions and 5 deletions
  1. +12
    -5
      countrylist.py

+ 12
- 5
countrylist.py View File

@ -157,11 +157,18 @@ class CountryList():
# For belgian list we need to select subsection of country
belgian = self.detect_belgian()
if belgian:
singles_section = self.wikicode.get_sections(
matches=belgian )[0].get_sections( matches="Singles" )[0]
else:
singles_section = self.wikicode.get_sections(matches="Singles")[0]
# Select Singles-Section
# Catch Error if we have none
try:
if belgian:
singles_section = self.wikicode.get_sections(
matches=belgian )[0].get_sections( matches="Singles" )[0]
else:
singles_section = self.wikicode.get_sections(
matches="Singles" )[0]
except IndexError:
raise CountryListError( "No Singles-Section found!")
# Since we have multiple categories in some countrys we need
# to select the first wrapping template


Loading…
Cancel
Save