diff --git a/lib/galaxy/util/__init__.py b/lib/galaxy/util/__init__.py index 1c2bbf19d9e..ce3104bd104 100644 --- a/lib/galaxy/util/__init__.py +++ b/lib/galaxy/util/__init__.py @@ -1015,7 +1015,7 @@ def roundify(amount, sfs=2): return amount[0:sfs] + '0' * (len(amount) - sfs) -def unicodify(value, encoding=DEFAULT_ENCODING, error='replace', strip_null=False): +def unicodify(value, encoding=DEFAULT_ENCODING, error='replace', strip_null=False, log_exception=True): """ Returns a Unicode string or None. @@ -1041,8 +1041,9 @@ def unicodify(value, encoding=DEFAULT_ENCODING, error='replace', strip_null=Fals if not isinstance(value, str): value = str(value, encoding, error) except Exception as e: - msg = "Value '{}' could not be coerced to Unicode: {}('{}')".format(repr(value), type(e).__name__, e) - log.exception(msg) + if log_exception: + msg = "Value '{}' could not be coerced to Unicode: {}('{}')".format(repr(value), type(e).__name__, e) + log.exception(msg) raise if strip_null: return value.replace('\0', '') diff --git a/lib/galaxy/util/template.py b/lib/galaxy/util/template.py index 037daf8e880..13cd2951fec 100644 --- a/lib/galaxy/util/template.py +++ b/lib/galaxy/util/template.py @@ -77,7 +77,7 @@ def fill_template(template_text, raise first_exception or e t = klass(searchList=[context]) try: - return unicodify(t) + return unicodify(t, log_exception=False) except NotFound as e: if first_exception is None: first_exception = e