From 87aee8c42a724e8cc627a870e10df71777a602df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?GOLDERWEB=20=E2=80=93=20Jonathan=20Golder?= Date: Mon, 9 Nov 2015 20:06:36 +0100 Subject: [PATCH] CountryList-Module: Implment methods for handling Titel-Parameter --- countrylist.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/countrylist.py b/countrylist.py index 0cfe394..fee11ab 100644 --- a/countrylist.py +++ b/countrylist.py @@ -205,3 +205,25 @@ class CountryList(): else: raise CountryListEntryError( "Template Parameter 'Chartein' is \ missing!" ) + + def prepare_titel( self ): + """ + Loads and prepares Titel of latest entry + """ + + # If self._titel_raw is not set, get it + if not self._titel_raw: + self.get_titel_value() + + self.titel = self._titel_raw + + def get_titel_value( self ): + """ + Reads value of Titel parameter + If param is not present raise Error + """ + if self.entry.has( "Titel" ): + self._titel_raw = self.entry.get("Titel").value.strip() + else: + raise CountryListEntryError( "Template Parameter 'Titel' is \ +missing!" )