forked from ScoDoc/ScoDoc
Preferences vides si pas de département
This commit is contained in:
parent
9a2c3b8174
commit
338e2a1c3f
@ -272,7 +272,7 @@ class BasePreferences(object):
|
|||||||
def __init__(self, dept_id: int):
|
def __init__(self, dept_id: int):
|
||||||
dept = Departement.query.get(dept_id)
|
dept = Departement.query.get(dept_id)
|
||||||
if not dept:
|
if not dept:
|
||||||
raise ScoValueError(f"Invalid departement: {dept_id}")
|
raise ScoValueError(f"BasePreferences: Invalid departement: {dept_id}")
|
||||||
self.dept_id = dept.id
|
self.dept_id = dept.id
|
||||||
self.init()
|
self.init()
|
||||||
self.load()
|
self.load()
|
||||||
@ -2152,7 +2152,10 @@ class SemPreferences:
|
|||||||
|
|
||||||
def __init__(self, formsemestre_id=None, dept_id=None):
|
def __init__(self, formsemestre_id=None, dept_id=None):
|
||||||
self.formsemestre_id = formsemestre_id
|
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):
|
def __getitem__(self, name):
|
||||||
return self.base_prefs.get(self.formsemestre_id, name)
|
return self.base_prefs.get(self.formsemestre_id, name)
|
||||||
|
Loading…
Reference in New Issue
Block a user