mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
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
This commit is contained in:
@@ -291,7 +291,7 @@ def id_safe(string):
|
|||||||
|
|
||||||
class Spreadsheet():
|
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=''):
|
def __init__(self, csv_data=None, rows=None, filename=''):
|
||||||
|
|
||||||
@@ -322,7 +322,7 @@ class Spreadsheet():
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def can_handle(cls, filename):
|
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
|
@staticmethod
|
||||||
def get_extension(filename):
|
def get_extension(filename):
|
||||||
|
|||||||
Reference in New Issue
Block a user