From e1824aa9147efb6b6f1e4b9dbef983f0ddbe7b9e Mon Sep 17 00:00:00 2001 From: Jack McCrea Date: Sat, 22 Feb 2014 23:21:09 +0000 Subject: [PATCH] Fix file_preview view --- app/views.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views.py b/app/views.py index 3285c30..41b2123 100644 --- a/app/views.py +++ b/app/views.py @@ -103,9 +103,15 @@ def file_preview(request, file = None): file_name_without_extension = file if not ds.check_exists(GRAPH_BUCKET + '/' + file_name_without_extension + '.png', None): file_name_without_extension = None - #TODO: Might need to be simplified or moved to a function in fileinfo + #TODO: Might need to be simplified or moved to a function in fileinfo # TODO the folowing should be replaced by a method in the APIDatastore lst = ds.list(DATA_BUCKET) + file_info = None + for temp_file in lst: + temp_file.filename = temp_file.filename.rpartition('/')[2] + if temp_file.filename == file: + file_info = temp_file; + return render(request, 'file_preview.html', {'current_file' : file_info, 'authed_user_nick': authed_user_nick, 'file_name_without_extension' : file_name_without_extension}) ########################################################################### ## \brief Is called when the pagelet containing the app's main panel is requested.