workflows: allow django templates to get image for geocoding (#68209)
This commit is contained in:
parent
0ab0c2ea11
commit
ecb013bdba
|
@ -3472,10 +3472,12 @@ def test_geolocate_image(pub):
|
|||
item = GeolocateWorkflowStatusItem()
|
||||
item.method = 'photo_variable'
|
||||
|
||||
item.photo_variable = '=form_var_file_raw'
|
||||
item.perform(formdata)
|
||||
assert int(formdata.geolocations['base']['lat']) == -1
|
||||
assert int(formdata.geolocations['base']['lon']) == 6
|
||||
for expression in ('=form_var_file_raw', '{{ form_var_file }}', '{{ form_var_file_raw }}'):
|
||||
formdata.geolocations = None
|
||||
item.photo_variable = expression
|
||||
item.perform(formdata)
|
||||
assert int(formdata.geolocations['base']['lat']) == -1
|
||||
assert int(formdata.geolocations['base']['lon']) == 6
|
||||
|
||||
# invalid expression
|
||||
formdata.geolocations = None
|
||||
|
|
|
@ -195,9 +195,11 @@ class GeolocateWorkflowStatusItem(WorkflowStatusItem):
|
|||
if Image is None:
|
||||
return
|
||||
|
||||
value = self.compute(self.photo_variable)
|
||||
if not value:
|
||||
return
|
||||
with get_publisher().complex_data():
|
||||
value = self.compute(self.photo_variable, allow_complex=True)
|
||||
if not value:
|
||||
return
|
||||
value = get_publisher().get_cached_complex_data(value)
|
||||
|
||||
if not hasattr(value, 'get_file_pointer'):
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue