summaryrefslogtreecommitdiff
path: root/bin/report/interface.py
diff options
context:
space:
mode:
authorYSA (Openerp) <ysa@tinyerp.com>2011-01-20 11:07:33 +0530
committerYSA (Openerp) <ysa@tinyerp.com>2011-01-20 11:07:33 +0530
commitf030d1219e2411e4b557f960d603fca1fcbb012e (patch)
treef7cc7e772563e2a1fecc9713987b569af35bd0d4 /bin/report/interface.py
parent1b287f9b7b7ffc6719a7839753597341cc75d7fb (diff)
parent10a6bb350c2f054e262ee4649855185795e611d5 (diff)
Merge with trunk-server
bzr revid: ysa@tinyerp.com-20110120053733-ws7mfcfw15p0iyy1
Diffstat (limited to 'bin/report/interface.py')
-rw-r--r--bin/report/interface.py14
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('&', '&amp;').replace('<','&lt;').replace('>','&gt;')
+def toxml(value):
+ unicode_value = tools.ustr(value)
+ return unicode_value.replace('&', '&amp;').replace('<','&lt;').replace('>','&gt;')
class report_int(netsvc.Service):
def __init__(self, name, audience='*'):