def get_csv_filename(): if request.method != 'POST': return if 'file' not in request.files: return csv_file = request.files['file'] if csv_file.filename == '': return if csv_file and self._allowed_file(csv_file.filename): return get_file_path_for_import_csv(csv_file)
def get_import_data(self): if request.method == 'POST': if 'file' not in request.files: return {'type': 'localCSV', 'csv_filename': None} csv_file = request.files['file'] if csv_file.filename == '': return {'type': 'localCSV', 'csv_filename': None} if csv_file and self._allowed_file(csv_file.filename): file_path = get_file_path_for_import_csv(csv_file) return {'type': 'localCSV', 'csv_filename': file_path} return {'type': 'localCSV', 'csv_filename': None}