Raise CountryListError if Page exists but no valid Single-Section exists
This commit is contained in:
@@ -157,11 +157,18 @@ class CountryList():
|
|||||||
# For belgian list we need to select subsection of country
|
# For belgian list we need to select subsection of country
|
||||||
belgian = self.detect_belgian()
|
belgian = self.detect_belgian()
|
||||||
|
|
||||||
if belgian:
|
# Select Singles-Section
|
||||||
singles_section = self.wikicode.get_sections(
|
# Catch Error if we have none
|
||||||
matches=belgian )[0].get_sections( matches="Singles" )[0]
|
try:
|
||||||
else:
|
if belgian:
|
||||||
singles_section = self.wikicode.get_sections(matches="Singles")[0]
|
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
|
# Since we have multiple categories in some countrys we need
|
||||||
# to select the first wrapping template
|
# to select the first wrapping template
|
||||||
|
|||||||
Reference in New Issue
Block a user