Commit 6e4d8625 authored by Jérome Perrin's avatar Jérome Perrin Committed by Arnaud Fontaine

BusinessTemplate: Fix some lxml warnings for `findall` (!1751).

FutureWarning: This search incorrectly ignores the root element, and will be
fixed in a future version.  If you rely on the current behaviour, change it to
'.//role'.
parent 57c609da
...@@ -2542,7 +2542,7 @@ class PortalTypeTemplateItem(ObjectTemplateItem): ...@@ -2542,7 +2542,7 @@ class PortalTypeTemplateItem(ObjectTemplateItem):
# import workflow chain for portal_type # import workflow chain for portal_type
result_dict = {} result_dict = {}
xml = parse(file) xml = parse(file)
chain_list = xml.findall('//chain') chain_list = xml.findall('.//chain')
for chain in chain_list: for chain in chain_list:
portal_type = chain.find('type').text portal_type = chain.find('type').text
workflow = chain.find('workflow').text or '' workflow = chain.find('workflow').text or ''
...@@ -5000,7 +5000,7 @@ class LocalRolesTemplateItem(BaseTemplateItem): ...@@ -5000,7 +5000,7 @@ class LocalRolesTemplateItem(BaseTemplateItem):
return return
xml = parse(file) xml = parse(file)
# local roles # local roles
local_roles_list = xml.findall('//role') local_roles_list = xml.findall('.//role')
local_roles_dict = {} local_roles_dict = {}
for role in local_roles_list: for role in local_roles_list:
id = role.get('id') id = role.get('id')
...@@ -5009,7 +5009,7 @@ class LocalRolesTemplateItem(BaseTemplateItem): ...@@ -5009,7 +5009,7 @@ class LocalRolesTemplateItem(BaseTemplateItem):
# local roles group id # local roles group id
local_roles_group_id_dict = {} local_roles_group_id_dict = {}
for local_role_group_id in xml.findall('//local_role_group_id'): for local_role_group_id in xml.findall('.//local_role_group_id'):
role_set = set() role_set = set()
for principal in local_role_group_id.findall('./principal'): for principal in local_role_group_id.findall('./principal'):
role_set.add((principal.get('id'), principal.text)) role_set.add((principal.get('id'), principal.text))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment