summaryrefslogtreecommitdiff
path: root/bin/wizard/__init__.py
diff options
context:
space:
mode:
authorRaphaël Valyi <rvalyi@gmail.com>2009-10-28 18:04:43 -0200
committerRaphaël Valyi <rvalyi@gmail.com>2009-10-28 18:04:43 -0200
commitc9d35c7012162e69b6edf4fbe72ba44636b6cd25 (patch)
treef09bf8b9a399b789a6c96eff7ff6b7f0bceeb215 /bin/wizard/__init__.py
parentdb8f833229f950c7bc7056cc650704f2b37d605e (diff)
[MERGE] lxml+etree instead of deprecated XML libs which prevent install on Ubuntu. Merged from old_trunk branch because on ne trunk, commits were not atomics anymore (after pig merge + bzr unability to track partial merge origins).
merge directive used was: bzr merge -r 1825..1826 lp:~openerp/openobject-server/old_trunk tested main flows on manufacturing database + French -> no bug found; still will commit a few more commits related to trunk + etree lp bug: https://launchpad.net/bugs/429519 fixed bzr revid: rvalyi@gmail.com-20091028200443-2ciyhqaz7rczdusy
Diffstat (limited to 'bin/wizard/__init__.py')
-rw-r--r--bin/wizard/__init__.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/bin/wizard/__init__.py b/bin/wizard/__init__.py
index 1621559c628..378f9ac4563 100644
--- a/bin/wizard/__init__.py
+++ b/bin/wizard/__init__.py
@@ -24,7 +24,7 @@ import netsvc
from tools import copy
from tools.misc import UpdateableStr, UpdateableDict
from tools.translate import translate
-from xml import dom
+from lxml import etree
import ir
import pooler
@@ -50,13 +50,12 @@ class interface(netsvc.Service):
self.wiz_name = name
def translate_view(self, cr, node, state, lang):
- if node.nodeType == node.ELEMENT_NODE:
- if node.hasAttribute('string') and node.getAttribute('string'):
- trans = translate(cr, self.wiz_name+','+state, 'wizard_view', lang, node.getAttribute('string').encode('utf8'))
+ if node.get('string'):
+ trans = translate(cr, self.wiz_name+','+state, 'wizard_view', lang, node.get('string').encode('utf8'))
if trans:
- node.setAttribute('string', trans)
- for n in node.childNodes:
- self.translate_view(cr, n, state, lang)
+ node.set('string', trans)
+ for n in node.getchildren():
+ self.translate_view(cr, n, state, lang)
def execute_cr(self, cr, uid, data, state='init', context=None):
if not context:
@@ -132,9 +131,9 @@ class interface(netsvc.Service):
# translate arch
if not isinstance(arch, UpdateableStr):
- doc = dom.minidom.parseString(arch.encode('utf8'))
+ doc = etree.XML(arch)
self.translate_view(cr, doc, state, lang)
- arch = doc.toxml()
+ arch = etree.tostring(doc)
# translate buttons
button_list = list(button_list)