From 23b4b760fd05b638f376ba5f1460fd61556a8078 Mon Sep 17 00:00:00 2001 From: philipp Date: Tue, 11 Oct 2016 19:37:32 +0000 Subject: [PATCH] Fixed two issues in wrvalidators module - now all tests pass for that module. git-svn-id: http://www.winterrodeln.org/svn/wrpylib/trunk@2499 7aebc617-e5e2-0310-91dc-80fb5f6d2477 --- wrpylib/wrvalidators.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wrpylib/wrvalidators.py b/wrpylib/wrvalidators.py index c736750..6697be9 100644 --- a/wrpylib/wrvalidators.py +++ b/wrpylib/wrvalidators.py @@ -700,8 +700,8 @@ def wikibox_to_template(value, name, converter_dict): def template_from_str(value, name): wikicode = mwparserfromhell.parse(value) - template_list = wikicode.filter_templates(name) - if len(name) == 0: + template_list = [template for template in wikicode.filter_templates(name) if template.name.strip() == name] + if len(template_list) == 0: raise ValueError('No "{}" template was found'.format(name)) if len(template_list) > 1: raise ValueError('{} "{}" templates were found'.format(len(template_list), name)) @@ -756,7 +756,7 @@ def rodelbahnbox_from_template(template): def rodelbahnbox_to_template(value): - return wikibox_to_template(value, RODELBAHNBOX_DICT, RODELBAHNBOX_TEMPLATE_NAME) + return wikibox_to_template(value, RODELBAHNBOX_TEMPLATE_NAME, RODELBAHNBOX_DICT) def rodelbahnbox_from_str(value): -- 2.39.5