Processing of zipped files
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user