@@ -17,6 +17,7 @@ def allowed_file(filename):
17
17
return '.' in filename and \
18
18
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS """
19
19
20
+
20
21
# make directories
21
22
def create_dir (dir_name ):
22
23
dir_path = os .path .abspath (dir_name )
@@ -57,11 +58,9 @@ def upload():
57
58
58
59
for uploaded_file in uploaded_files :
59
60
if uploaded_file .filename != '' :
60
-
61
- file_path = os .path .join (UPLOADS_PATH ,
62
- uploaded_file .filename )
63
- uploaded_file .save (file_path )
64
- process_files (file_path )
61
+ file_path = os .path .join (UPLOADS_PATH , uploaded_file .filename )
62
+ uploaded_file .save (file_path )
63
+ process_files (file_path )
65
64
else :
66
65
flash ("invalid file type." )
67
66
return redirect (request .url )
@@ -80,9 +79,9 @@ def upload_success():
80
79
81
80
82
81
@app .route ('/download' )
83
-
84
82
def download ():
85
- return send_file (os .path .join (PROCESSED_PATH , 'certificates.tar.gz' ), as_attachment = True )
83
+ return send_file (os .path .join (PROCESSED_PATH , 'certificates.tar.gz' ),
84
+ as_attachment = True )
86
85
87
86
88
87
def extract_gz (file_path ):
@@ -133,7 +132,8 @@ def create_pdfs():
133
132
134
133
135
134
def create_tar_file ():
136
- with tarfile .open (os .path .join (PROCESSED_PATH , 'certificates.tar.gz' ), "w:gz" ) as tar :
135
+ with tarfile .open (os .path .join (PROCESSED_PATH , 'certificates.tar.gz' ),
136
+ "w:gz" ) as tar :
137
137
tar .add (PDF_PATH , arcname = os .path .basename (PDF_PATH ))
138
138
139
139
0 commit comments