From b4292615de88018abfb19383eec3b37b680d600d Mon Sep 17 00:00:00 2001 From: meow Date: Tue, 7 Jan 2020 18:27:22 +0500 Subject: [PATCH] Display more info about tracked files to user e.g creation_date, host on which it is stored, size etc --- uncloud/api/main.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/uncloud/api/main.py b/uncloud/api/main.py index 401c11f..50bc201 100644 --- a/uncloud/api/main.py +++ b/uncloud/api/main.py @@ -289,18 +289,16 @@ class ListUserFiles(Resource): settings['etcd']['file_prefix'], value_in_json=True ) return_files = [] - user_files = list( - filter( - lambda f: f.value['owner'] == data['name'], files - ) - ) + user_files = [f for f in files if f.value['owner'] == data['name']] for file in user_files: - return_files.append( - { - 'filename': file.value['filename'], - 'uuid': file.key.split('/')[-1], - } - ) + file_uuid = file.key.split('/')[-1] + file = file.value + file['uuid'] = file_uuid + + file.pop('sha512sum', None) + file.pop('owner', None) + + return_files.append(file) return {'message': return_files}, 200 else: return validator.get_errors(), 400