From e9722256eaf46a13dbb4948f45618dcd5fa337b9 Mon Sep 17 00:00:00 2001 From: Tom Byers Date: Wed, 16 Dec 2020 10:50:10 +0000 Subject: [PATCH] Rename Spreadsheet.allowed_file_extensions We will use this list in various views, to send them through to the file_upload component. These changes make it: - into a Set so it can't be altered - uppercase to show it is a constant --- app/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/utils.py b/app/utils.py index 2e309dcb4..19ad0668b 100644 --- a/app/utils.py +++ b/app/utils.py @@ -291,7 +291,7 @@ def id_safe(string): class Spreadsheet(): - allowed_file_extensions = ['csv', 'xlsx', 'xls', 'ods', 'xlsm', 'tsv'] + ALLOWED_FILE_EXTENSIONS = {'csv', 'xlsx', 'xls', 'ods', 'xlsm', 'tsv'} def __init__(self, csv_data=None, rows=None, filename=''): @@ -322,7 +322,7 @@ class Spreadsheet(): @classmethod def can_handle(cls, filename): - return cls.get_extension(filename) in cls.allowed_file_extensions + return cls.get_extension(filename) in cls.ALLOWED_FILE_EXTENSIONS @staticmethod def get_extension(filename):