Commit 7ba78745 authored by Yusei Tahara's avatar Yusei Tahara

Do nothing if form name space does not exist in element tree name

space dict, otherwise XPathEvalError occurs.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37870 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 41903e16
...@@ -979,6 +979,10 @@ class ODTStrategy(ODFStrategy): ...@@ -979,6 +979,10 @@ class ODTStrategy(ODFStrategy):
""" """
field_id = field.id field_id = field.id
reference_xpath = '//*[@form:name = "%s"]' % field_id reference_xpath = '//*[@form:name = "%s"]' % field_id
# if form name space is not in the name space dict of element tree,
# it means that there is no form in the tree. Then do nothing and return.
if not 'form' in element_tree.nsmap:
return
reference_list = element_tree.xpath(reference_xpath, namespaces=element_tree.nsmap) reference_list = element_tree.xpath(reference_xpath, namespaces=element_tree.nsmap)
for target_node in reference_list: for target_node in reference_list:
attr_dict = {} attr_dict = {}
......
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