CountryList-Module: Since we have multiple categories in some countrys we need to select the first wrapping template

This commit is contained in:
2015-11-20 14:44:26 +01:00
parent eca0142f71
commit 3864c9013c

View File

@@ -157,9 +157,17 @@ class CountryList():
else: else:
singles_section = self.wikicode.get_sections( matches="Singles" )[0] singles_section = self.wikicode.get_sections( matches="Singles" )[0]
# Since we have multiple categories in some countrys we need
# to select the first wrapping template
try:
wrapping_template = next( singles_section.ifilter_templates(
matches="Nummer-eins-Hits" ) )
except StopIteration:
raise CountryListError( "Wrapping template is missing!")
# Select the last occurence of template "Nummer-eins-Hits Zeile" in # Select the last occurence of template "Nummer-eins-Hits Zeile" in
# "Singles"-section # Wrapper-template
for self.entry in singles_section.ifilter_templates( for self.entry in wrapping_template.get("Inhalt").value.ifilter_templates(
matches="Nummer-eins-Hits Zeile" ): matches="Nummer-eins-Hits Zeile" ):
pass pass