Private
Public Access
1
0

Processing of zipped files

This commit is contained in:
Sander Roosendaal
2016-12-18 16:57:42 +01:00
parent f5236d429e
commit 4bda2f3539
4 changed files with 17 additions and 1 deletions

View File

@@ -100,6 +100,14 @@ def make_new_workout_from_email(rr,f2,name,cntr=0):
workouttype = 'rower'
f2 = f2.name
fileformat = get_file_type('media/'+f2)
if len(fileformat)==3 and fileformat[0]=='zip':
f_to_be_deleted = f2
with zipfile.ZipFile(f2) as z:
f2 = z.extract(z.namelist()[0],path='media/')
fileformat = fileformat[2]
os.remove(f_to_be_deleted)
if fileformat == 'unknown':
if settings.DEBUG:
res = handle_sendemail_unrecognized.delay(f2,