adding aggregation appkey to aggregation list generated by file/folder browsing backend response
@@ -74,6 +74,7 @@ def data_store_structure(request):
files = []
dirs = []
aggregations = []
+ _APPKEY = 'appkey'
# folder path relative to 'data/contents/' needed for the UI
folder_path = store_path[len("data/contents/"):]
for dname in store[0]: # directories
@@ -96,7 +97,7 @@ def data_store_structure(request):
folder_aggregation_type = aggregation_object.get_aggregation_class_name()
folder_aggregation_name = aggregation_object.get_aggregation_display_name()
folder_aggregation_id = aggregation_object.id
- folder_aggregation_appkey = aggregation_object.metadata.extra_metadata.get('appkey', '')
+ folder_aggregation_appkey = aggregation_object.metadata.extra_metadata.get(_APPKEY, '')
if aggregation_object.get_main_file is not None:
main_file = aggregation_object.get_main_file.file_name
else:
@@ -164,10 +165,14 @@ def data_store_structure(request):
# accept any extension
main_extension = ""
if f.extension and main_extension.endswith(f.extension):
+ if not hasattr(f.logical_file, 'folder') or f.logical_file.folder is None:
+ aggregation_appkey = f.logical_file.metadata.extra_metadata.get(_APPKEY, '')
+
aggregations.append({'logical_file_id': f.logical_file.id,
'name': f.logical_file.dataset_name,
'logical_type': f.logical_file.get_aggregation_class_name(),
'aggregation_name': f.logical_file.get_aggregation_display_name(),
+ 'aggregation_appkey': aggregation_appkey,
'main_file': f.logical_file.get_main_file.file_name,
'preview_data_url': f.logical_file.metadata.get_preview_data_url(
resource=resource,
@@ -180,7 +185,7 @@ def data_store_structure(request):
aggregation_name = f.aggregation_display_name
aggregation_appkey = ''
if not hasattr(logical_file, 'folder') or logical_file.folder is None:
- aggregation_appkey = logical_file.metadata.extra_metadata.get('appkey', '')
+ aggregation_appkey = logical_file.metadata.extra_metadata.get(_APPKEY, '')
if 'url' in f.logical_file.extra_data:
f_ref_url = f.logical_file.extra_data['url']
