misc: handle unexpected XML contents for conditions (#23021)
This commit is contained in:
parent
26d70e4db0
commit
7f30f312c5
|
@ -1515,6 +1515,7 @@ class PageField(Field):
|
|||
post_conditions = None
|
||||
|
||||
def condition_init_with_xml(self, node, charset, include_id=False):
|
||||
self.condition = None
|
||||
if node is None:
|
||||
return
|
||||
if node.findall('type'):
|
||||
|
@ -1522,8 +1523,8 @@ class PageField(Field):
|
|||
'type': node.find('type').text.encode(charset),
|
||||
'value': node.find('value').text.encode(charset),
|
||||
}
|
||||
else:
|
||||
self.condition = {'type': 'python', 'value': node.text.encode(charset)}
|
||||
elif node.text:
|
||||
self.condition = {'type': 'python', 'value': node.text.strip().encode(charset)}
|
||||
|
||||
def post_conditions_init_with_xml(self, node, charset, include_id=False):
|
||||
if node is None:
|
||||
|
@ -1535,11 +1536,13 @@ class PageField(Field):
|
|||
'type': post_condition_node.find('condition/type').text.encode(charset),
|
||||
'value': post_condition_node.find('condition/value').text.encode(charset),
|
||||
}
|
||||
else:
|
||||
elif post_condition_node.find('condition').text:
|
||||
condition = {
|
||||
'type': 'python',
|
||||
'value': post_condition_node.find('condition').text.encode(charset),
|
||||
}
|
||||
else:
|
||||
continue
|
||||
self.post_conditions.append({
|
||||
'condition': condition,
|
||||
'error_message': post_condition_node.find('error_message').text.encode(charset),
|
||||
|
|
|
@ -119,14 +119,15 @@ class JumpWorkflowStatusItem(WorkflowStatusJumpItem):
|
|||
self.timeout = int(timeout)
|
||||
|
||||
def condition_init_with_xml(self, node, charset, include_id=False):
|
||||
self.condition = None
|
||||
if node is None:
|
||||
self.condition = None
|
||||
elif node.findall('type'):
|
||||
return
|
||||
if node.findall('type'):
|
||||
self.condition = {
|
||||
'type': node.find('type').text.encode(charset),
|
||||
'value': node.find('value').text.encode(charset),
|
||||
}
|
||||
else:
|
||||
elif node.text:
|
||||
# backward compatibility
|
||||
self.condition = {'type': 'python', 'value': node.text.encode(charset)}
|
||||
|
||||
|
|
Loading…
Reference in New Issue