# ---------------------
def webauskunft_from_str(value):
+ """Converts a URL or 'Nein' to a tuple
+ 'http://www.example.com/' -> (True, 'http://www.example.com/')
+ 'Nein' -> (False, None)
+ '' -> (None, None)
+
+ :param value: URL or 'Nein'
+ :return: tuple
+ """
return opt_no_german_from_str(value, url_from_str)
def template_from_str(value, name):
wikicode = mwparserfromhell.parse(value)
- template_list = [template for template in wikicode.filter_templates(name) if template.name.strip() == name]
+ template_list = wikicode.filter_templates(recursive=False, matches=lambda t: t.name.strip() == name)
if len(template_list) == 0:
raise ValueError('No "{}" template was found'.format(name))
if len(template_list) > 1: