Merge pull request 'soften error when logo not found' (#322) from jmplace/ScoDoc-Lille:soften_logos_error_message into master

Reviewed-on: https://scodoc.org/git/ScoDoc/ScoDoc/pulls/322
This commit is contained in:
Emmanuel Viennet 2022-02-22 20:02:23 +01:00
commit bd33b288db
2 changed files with 3 additions and 2 deletions

View File

@ -276,7 +276,7 @@ class Logo:
if self.mm is None: if self.mm is None:
return f'<logo name="{self.logoname}" width="?? mm" height="?? mm">' return f'<logo name="{self.logoname}" width="?? mm" height="?? mm">'
else: else:
return f'<logo name="{self.logoname}" width="{self.mm[0]}mm"">' return f'<logo name="{self.logoname}" width="{self.mm[0]}mm">'
def last_modified(self): def last_modified(self):
path = Path(self.filepath) path = Path(self.filepath)

View File

@ -304,8 +304,9 @@ def _return_logo(name="header", dept_id="", small=False, strict: bool = True):
# stockée dans /opt/scodoc-data/config/logos donc servie manuellement ici # stockée dans /opt/scodoc-data/config/logos donc servie manuellement ici
# from app.scodoc.sco_photos import _http_jpeg_file # from app.scodoc.sco_photos import _http_jpeg_file
logo = sco_logos.find_logo(name, dept_id, strict).select() logo = sco_logos.find_logo(name, dept_id, strict)
if logo is not None: if logo is not None:
logo.select()
suffix = logo.suffix suffix = logo.suffix
if small: if small:
with PILImage.open(logo.filepath) as im: with PILImage.open(logo.filepath) as im: