diff --git a/app/scodoc/sco_logos.py b/app/scodoc/sco_logos.py index 343c4c462f..278cccb9cc 100644 --- a/app/scodoc/sco_logos.py +++ b/app/scodoc/sco_logos.py @@ -136,7 +136,9 @@ def _list_dept_logos(dept_id=None, prefix=scu.LOGO_FILE_PREFIX): if os.access(path_dir.joinpath(entry).absolute(), os.R_OK): result = filename_parser.match(entry.name) if result: - logoname = result.group(1)[:-1] # retreive logoname from filename (less final dot) + logoname = result.group(1)[ + :-1 + ] # retreive logoname from filename (less final dot) logos[logoname] = Logo(logoname=logoname, dept_id=dept_id).select() return logos if len(logos.keys()) > 0 else None @@ -235,7 +237,7 @@ class Logo: unit = img.info.get("jfif_unit", 0) # 0 = no unit ; 1 = inch ; 2 = mm if self.density is not None: x_density, y_density = self.density - if unit != 0: + if unit != 0 and x_density != 0 and y_density != 0: unit2mm = [0, 1 / 0.254, 0.1][unit] x_mm = round(x_size * unit2mm / x_density, 2) y_mm = round(y_size * unit2mm / y_density, 2) @@ -244,7 +246,6 @@ class Logo: self.mm = None else: self.mm = None - self.size = (x_size, y_size) self.aspect_ratio = round(float(x_size) / y_size, 2)