changeset 706:59a3fb7fcac3

Prohibit "," and "|" in filter names
author Franz Glasner <f.glasner@feldmann-mg.com>
date Tue, 15 Aug 2023 10:38:38 +0200
parents 0485a033c95d
children 10fbc23b4dba
files configmix/variables.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/configmix/variables.py	Tue Aug 15 09:34:49 2023 +0200
+++ b/configmix/variables.py	Tue Aug 15 10:38:38 2023 +0200
@@ -132,9 +132,15 @@
 
 def add_filter(name, fn):
     """Register a variable filter function with name `name` and
-    implementation `fn`
+    implementation `fn`.
+
+    `name` may *not* contain ``,`` and ``|`` characters.
+
+    :raises ValueError: If an invalid `name` is given
 
     """
+    if ('|' in name) or (',' in name):
+        raise ValueError("invalid filter name: %s" % (name, ))
     _filter_registry[_normalized(name)] = fn