Allow several renderers names (separated by ";") in "text_to_html" function and "html" TALES extension
authorThierry Florac <thierry.florac@onf.fr>
Thu, 20 Dec 2018 08:38:06 +0100
changeset 302 6d48d5d39729
parent 301 bab73fc1c895
child 303 fd0365f94a2c
Allow several renderers names (separated by ";") in "text_to_html" function and "html" TALES extension
src/pyams_utils/text.py
--- a/src/pyams_utils/text.py	Mon Dec 17 14:32:29 2018 +0100
+++ b/src/pyams_utils/text.py	Thu Dec 20 08:38:06 2018 +0100
@@ -147,9 +147,11 @@
     """
     request = check_request()
     registry = request.registry
-    renderer = registry.queryMultiAdapter((text, request), IHTMLRenderer, name=renderer)
-    if renderer is not None:
-        return renderer.render()
+    for renderer_name in renderer.split(';'):
+        renderer = registry.queryMultiAdapter((text, request), IHTMLRenderer, name=renderer_name)
+        if renderer is not None:
+            text = renderer.render() or text
+    return text
 
 
 empty_marker = object()