Config logo: handle exception
This commit is contained in:
parent
d7d6d688ff
commit
8166fd1380
@ -117,7 +117,11 @@ class Logo:
|
|||||||
os.mkdir(self.dirpath)
|
os.mkdir(self.dirpath)
|
||||||
|
|
||||||
def create(self, stream):
|
def create(self, stream):
|
||||||
|
"enregistre logo"
|
||||||
|
try:
|
||||||
img_type = guess_image_type(stream)
|
img_type = guess_image_type(stream)
|
||||||
|
except ValueError as exc:
|
||||||
|
raise ScoValueError("fichier logo invalide") from exc
|
||||||
if img_type not in scu.LOGOS_IMAGES_ALLOWED_TYPES:
|
if img_type not in scu.LOGOS_IMAGES_ALLOWED_TYPES:
|
||||||
raise ScoValueError(f"type d'image invalide ({img_type})")
|
raise ScoValueError(f"type d'image invalide ({img_type})")
|
||||||
self._set_format(img_type)
|
self._set_format(img_type)
|
||||||
|
Loading…
Reference in New Issue
Block a user