mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #11355 from mvdbeek/fix_non_fatal_log_exceptions_in_cheetah_handling
[21.01] Don't log handled exceptions when filling cheetah template
This commit is contained in:
@@ -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', '')
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user