From 5aa704268825d0c353fbccc4c9d5ef4ff4750a0b Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Sun, 6 Mar 2011 17:48:56 +0200 Subject: [PATCH] anonymization: try to fix the deprecation warnings Unfortunately, we cannot use bool(foobar) on xpath() results. bzr revid: p_christ@hol.gr-20110306154856-ajg11p9ysee1t4e4 --- addons/anonymization/anonymization.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/anonymization/anonymization.py b/addons/anonymization/anonymization.py index 35a1fe83f56..2814227015a 100644 --- a/addons/anonymization/anonymization.py +++ b/addons/anonymization/anonymization.py @@ -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'}))