diff --git a/custom_components/multiscrape/util.py b/custom_components/multiscrape/util.py index 651e8010..3a85bfef 100644 --- a/custom_components/multiscrape/util.py +++ b/custom_components/multiscrape/util.py @@ -7,7 +7,7 @@ def create_renderer(hass, value_template): - """Create a renderer based on variable_template value.""" + """Create a template renderer based on value_template.""" if value_template is None: return lambda value: value @@ -29,9 +29,12 @@ def _render(value): def create_dict_renderer(hass, templates_dict): + """Create template renderers for a dictionary with value_templates.""" if templates_dict is None: return lambda value: {} + # Create a copy of the templates_dict to avoid modification of the original + templates_dict = templates_dict.copy() for item in templates_dict: templates_dict[item] = create_renderer(hass, templates_dict[item])