From d0d83300a5a3940680759e0f8370b3a089b9d080 Mon Sep 17 00:00:00 2001 From: ced <> Date: Fri, 5 Oct 2007 05:24:45 +0000 Subject: [PATCH] Add encondig to xml and remove \n and \t bzr revid: ced-a179ac742c1657026200e28c684a8548356be624 --- bin/osv/orm.py | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index f011bf03838..3727041f77c 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1337,11 +1337,11 @@ class orm(object): if not context: context={} fields_def = self.__view_look_dom(cr, user, node, context=context) - arch = node.toxml() + arch = node.toxml(encoding="utf-8").replace('\n', '').replace('\t', '') fields = self.fields_get(cr, user, fields_def.keys(), context) for field in fields_def: fields[field].update(fields_def[field]) - return arch,fields + return arch, fields # @@ -1407,7 +1407,7 @@ class orm(object): ]) tag = "<%s%s>" % (node2.localName, attrs) raise AttributeError, "Couldn't find tag '%s' in parent view !" % tag - return doc_src.toxml() + return doc_src.toxml(encoding="utf-8").replace('\n', '').replace('\t', '') result = {'type':view_type, 'model':self._name} @@ -1449,17 +1449,23 @@ class orm(object): # otherwise, build some kind of default view if view_type == 'form': res = self.fields_get(cr, user, context=context) - xml = '''\n
\n''' % (self._description,) + xml = '''''' + '''''' % (self._description,) for x in res: if res[x]['type'] not in ('one2many', 'many2many'): - xml += '\t\n' % (x,) + xml += '' % (x,) if res[x]['type'] == 'text': xml += "" xml += "" elif view_type == 'tree': - xml = '''\n\n\t\n''' % (self._description,self._rec_name) + xml = '''''' + '''''' \ + % (self._description, self._rec_name) elif view_type == 'calendar': - xml = '''\n\n\t\n''' % (self._description,self._date_name,self._rec_name) + xml = '''''' + '''''' + '''''' \ + % (self._description, self._date_name, self._rec_name) else: xml = '' result['arch'] = xml @@ -1474,13 +1480,22 @@ class orm(object): if toolbar: def clean(x): x = x[2] - for key in ('report_sxw_content','report_rml_content','report_sxw','report_rml', 'report_sxw_content_data', 'report_rml_content_data'): + for key in ('report_sxw_content', 'report_rml_content', + 'report_sxw', 'report_rml', + 'report_sxw_content_data', 'report_rml_content_data'): if key in x: del x[key] return x - resprint = self.pool.get('ir.values').get(cr, user, 'action', 'client_print_multi', [(self._name, False)], False, context) - resaction = self.pool.get('ir.values').get(cr, user, 'action', 'client_action_multi', [(self._name, False)], False, context) - resrelate = self.pool.get('ir.values').get(cr, user, 'action', 'client_action_relate', [(self._name, False)], False, context) + ir_values_obj = self.pool.get('ir.values') + resprint = ir_values_obj.get(cr, user, 'action', + 'client_print_multi', [(self._name, False)], False, + context) + resaction = ir_values_obj.get(cr, user, 'action', + 'client_action_multi', [(self._name, False)], False, + context) + resrelate = ir_values_obj.get(cr, user, 'action', + 'client_action_relate', [(self._name, False)], False, + context) resprint = map(clean, resprint) resaction = map(clean, resaction) resaction = filter(lambda x: not x.get('multi',False), resaction)