From 9527240ea82230c4e0f381a651c5a5575efbcb13 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 30 Sep 2022 09:37:20 +0200 Subject: [PATCH] code cleaning --- app/scodoc/sco_abs.py | 1 - app/scodoc/sco_logos.py | 19 ++++++++++--------- sco_version.py | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/scodoc/sco_abs.py b/app/scodoc/sco_abs.py index af218e7a2a..3cdd17e26e 100644 --- a/app/scodoc/sco_abs.py +++ b/app/scodoc/sco_abs.py @@ -420,7 +420,6 @@ WHERE A.ETUDID = %(etudid)s def list_abs_date(etudid, beg_date=None, end_date=None): """Liste des absences et justifs entre deux dates (inclues).""" - print("On rentre") cnx = ndb.GetDBConnexion() cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor) diff --git a/app/scodoc/sco_logos.py b/app/scodoc/sco_logos.py index 278cccb9cc..d742eba203 100644 --- a/app/scodoc/sco_logos.py +++ b/app/scodoc/sco_logos.py @@ -39,13 +39,14 @@ import re import shutil from pathlib import Path -from flask import abort, current_app, url_for +from flask import current_app, url_for +from PIL import Image as PILImage from werkzeug.utils import secure_filename -from app import Departement, ScoValueError +from app import log +from app.models import Departement from app.scodoc import sco_utils as scu from app.scodoc.sco_exceptions import ScoValueError -from PIL import Image as PILImage GLOBAL = "_" # category for server level logos @@ -323,13 +324,13 @@ def guess_image_type(stream) -> str: def make_logo_local(logoname, dept_name): depts = Departement.query.filter_by(acronym=dept_name).all() if len(depts) == 0: - print(f"no dept {dept_name} found. aborting") + log(f"no dept {dept_name} found. aborting") return if len(depts) > 1: - print(f"several depts {dept_name} found. aborting") + log(f"several depts {dept_name} found. aborting") return dept = depts[0] - print(f"Move logo {logoname}' from global to {dept.acronym}") + log(f"Move logo {logoname}' from global to {dept.acronym}") old_path_wild = f"/opt/scodoc-data/config/logos/logo_{logoname}.*" new_dir = f"/opt/scodoc-data/config/logos/logos_{dept.id}" logos = glob.glob(old_path_wild) @@ -338,15 +339,15 @@ def make_logo_local(logoname, dept_name): filename = os.path.split(logo)[1] new_name = os.path.sep.join([new_dir, filename]) if os.path.exists(new_name): - print("local version of global logo already exists. aborting") + log("local version of global logo already exists. aborting") return # create new__dir if necessary if not os.path.exists(new_dir): - print(f"- create {new_dir} directory") + log(f"- create {new_dir} directory") os.mkdir(new_dir) # move global logo (all suffixes) to local dir note: pre existent file (logo_XXX.*) in local dir does not # prevent operation if there is no conflict with moved files # At this point everything is ok so we can do files manipulation for logo in logos: shutil.move(logo, new_dir) - # print(f"moved {n_moves}/{n} etuds") + # log(f"moved {n_moves}/{n} etuds") diff --git a/sco_version.py b/sco_version.py index 61942977aa..d22cf8c3bf 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.3.47" +SCOVERSION = "9.3.48" SCONAME = "ScoDoc"