# HG changeset patch # User Thierry Florac # Date 1547803460 -3600 # Node ID 8984904dc04096ea77618bb8924be83f0aa9b68c # Parent 0f0e69a1d793ae380c61b4f79289f7d7817b2f62 Return empty string in TALES expression if required extension can't be found diff -r 0f0e69a1d793 -r 8984904dc040 src/pyams_utils/tales.py --- a/src/pyams_utils/tales.py Thu Jan 17 14:23:59 2019 +0100 +++ b/src/pyams_utils/tales.py Fri Jan 18 10:24:20 2019 +0100 @@ -16,15 +16,15 @@ # import standard library import re -# import interfaces -from pyams_utils.interfaces.tales import ITALESExtension - # import packages from chameleon.astutil import Symbol from chameleon.codegen import template from chameleon.tales import StringExpr from zope.contentprovider.tales import addTALNamespaceData +# import interfaces +from pyams_utils.interfaces.tales import ITALESExtension + class ContextExprMixin(object): """Mixin-class for expression compilers""" @@ -97,9 +97,9 @@ if extension is None: extension = registry.queryAdapter(context, ITALESExtension, name=name) - # provide a useful error message, if the extension was not found. + # return an empty string if the extension was not found. if extension is None: - return None + return '' # Insert the data gotten from the context addTALNamespaceData(extension, econtext)