anonymization: try to fix the deprecation warnings

Unfortunately, we cannot use bool(foobar) on xpath() results.

bzr revid: p_christ@hol.gr-20110306154856-ajg11p9ysee1t4e4
This commit is contained in:
P. Christeas 2011-03-06 17:48:56 +02:00
parent ab69f51931
commit 5aa7042688
1 changed files with 2 additions and 3 deletions

View File

@ -295,9 +295,8 @@ class ir_model_fields_anonymize_wizard(osv.osv_memory):
eview = etree.fromstring(res['arch'])
placeholder = eview.xpath("group[@name='placeholder1']")
placeholder = len(placeholder) and placeholder[0] or None
if placeholder:
if len(placeholder):
placeholder = placeholder[0]
if step == 'new_window' and state == 'clear':
# clicked in the menu and the fields are not anonymized: warn the admin that backuping the db is very important
placeholder.addnext(etree.Element('field', {'name': 'msg', 'colspan': '4', 'nolabel': '1'}))