diff options
Diffstat (limited to 'bin/report/interface.py')
| -rw-r--r-- | bin/report/interface.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/bin/report/interface.py b/bin/report/interface.py index c6ceae4d0e4..36f54b31fdb 100644 --- a/bin/report/interface.py +++ b/bin/report/interface.py @@ -33,16 +33,12 @@ import render import urllib # -# encode a value to a string in utf8 and converts XML entities +# coerce any type to a unicode string (to preserve non-ascii characters) +# and escape XML entities # -def toxml(val): - if isinstance(val, str): - str_utf8 = val - elif isinstance(val, unicode): - str_utf8 = tools.ustr(val) - else: - str_utf8 = str(val) - return str_utf8.replace('&', '&').replace('<','<').replace('>','>') +def toxml(value): + unicode_value = tools.ustr(value) + return unicode_value.replace('&', '&').replace('<','<').replace('>','>') class report_int(netsvc.Service): def __init__(self, name, audience='*'): |
