Slight code optimisation
This commit is contained in:
parent
8d8f5068e1
commit
3b6fa6ef27
@ -139,11 +139,12 @@ def item_parse_attachments(response):
|
|||||||
generated link.
|
generated link.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if 'properties' not in response or 'attachments' not in response['properties']:
|
attachments = response.get('properties', {}).get('attachments', None)
|
||||||
|
if not attachments:
|
||||||
return
|
return
|
||||||
|
|
||||||
files_collection = current_app.data.driver.db['files']
|
files_collection = current_app.data.driver.db['files']
|
||||||
for attachment in response['properties']['attachments']:
|
for attachment in attachments:
|
||||||
# Make a list from the property path
|
# Make a list from the property path
|
||||||
field_name_path = attachment['field'].split('.')
|
field_name_path = attachment['field'].split('.')
|
||||||
# This currently allow to access only properties inside of
|
# This currently allow to access only properties inside of
|
||||||
|
Loading…
x
Reference in New Issue
Block a user