workflows: don't try substituting images with non-images (#17174)
This commit is contained in:
parent
01768bf2ba
commit
2463d9e8a5
|
@ -1931,6 +1931,21 @@ def test_export_to_model_image(pub):
|
|||
# check the image has been replaced by the one from the formdata
|
||||
assert zinfo.file_size == len(image_data)
|
||||
|
||||
# check with missing data or wrong kind of data
|
||||
for field_value in (None, 'wrong kind'):
|
||||
formdata = formdef.data_class()()
|
||||
formdata.data = {'3': field_value}
|
||||
formdata.just_created()
|
||||
formdata.store()
|
||||
pub.substitutions.feed(formdata)
|
||||
|
||||
item.perform(formdata)
|
||||
|
||||
zfile = zipfile.ZipFile(formdata.evolution[-1].parts[0].filename, mode='r')
|
||||
zinfo = zfile.getinfo('Pictures/10000000000000320000003276E9D46581B55C88.jpg')
|
||||
# check the original image has been left
|
||||
assert zinfo.file_size == 580
|
||||
|
||||
def test_global_timeouts(pub):
|
||||
FormDef.wipe()
|
||||
Workflow.wipe()
|
||||
|
|
|
@ -436,6 +436,8 @@ class ExportToModel(WorkflowStatusItem):
|
|||
variable_image = self.compute(name)
|
||||
except:
|
||||
continue
|
||||
if not hasattr(variable_image, 'get_content'):
|
||||
continue
|
||||
image = [x for x in node.getchildren() if x.tag == DRAW_IMAGE][0]
|
||||
new_images[image.attrib.get(XLINK_HREF)] = variable_image
|
||||
|
||||
|
|
Loading…
Reference in New Issue