fixed predavanja bug
This commit is contained in:
parent
621d411e30
commit
74c085b0a7
|
@ -194,13 +194,11 @@ class UploadHandler:
|
||||||
except Exception:
|
except Exception:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
|
def check_suffixes(self, files):
|
||||||
@staticmethod
|
|
||||||
def check_suffixes(files):
|
|
||||||
for key, f in files.items():
|
for key, f in files.items():
|
||||||
if key.startswith('file'):
|
if key.startswith('file'):
|
||||||
suffix = f.filename.split('.')[-1]
|
suffix = f.filename.split('.')[-1]
|
||||||
if ENABLED_FILETYPES and suffix not in ENABLED_FILETYPES:
|
if self.ENABLED_FILETYPES and suffix not in self.ENABLED_FILETYPES:
|
||||||
return 'Datoteka "{}" ni pravilnega formata.'.format(f.filename)
|
return 'Datoteka "{}" ni pravilnega formata.'.format(f.filename)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -220,7 +218,7 @@ class UploadHandler:
|
||||||
elif len(files) < 1:
|
elif len(files) < 1:
|
||||||
return 'Priložena ni bila nobena datoteka.', 400
|
return 'Priložena ni bila nobena datoteka.', 400
|
||||||
|
|
||||||
err = UploadHandler.check_suffixes(files)
|
err = self.check_suffixes(files)
|
||||||
if err:
|
if err:
|
||||||
return err, 400
|
return err, 400
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user