From 338e2a1c3f22efecbcc6ac0b0c3107dbfca345a6 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 1 Aug 2022 21:43:04 +0200 Subject: [PATCH] =?UTF-8?q?Preferences=20vides=20si=20pas=20de=20d=C3=A9pa?= =?UTF-8?q?rtement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_preferences.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/scodoc/sco_preferences.py b/app/scodoc/sco_preferences.py index c4955cd55..5a35c2678 100644 --- a/app/scodoc/sco_preferences.py +++ b/app/scodoc/sco_preferences.py @@ -272,7 +272,7 @@ class BasePreferences(object): def __init__(self, dept_id: int): dept = Departement.query.get(dept_id) if not dept: - raise ScoValueError(f"Invalid departement: {dept_id}") + raise ScoValueError(f"BasePreferences: Invalid departement: {dept_id}") self.dept_id = dept.id self.init() self.load() @@ -2152,7 +2152,10 @@ class SemPreferences: def __init__(self, formsemestre_id=None, dept_id=None): self.formsemestre_id = formsemestre_id - self.base_prefs = get_base_preferences(dept_id=dept_id) + if dept_id is None and g.scodoc_dept is None: + self.base_prefs = {} + else: + self.base_prefs = get_base_preferences(dept_id=dept_id) def __getitem__(self, name): return self.base_prefs.get(self.formsemestre_id, name)