1
0
forked from ScoDoc/ScoDoc

Preferences vides si pas de département

This commit is contained in:
Emmanuel Viennet 2022-08-01 21:43:04 +02:00
parent 9a2c3b8174
commit 338e2a1c3f

View File

@ -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)