fix: preference par departement

This commit is contained in:
Emmanuel Viennet 2021-09-16 11:45:39 +02:00
parent 3666f8b1ec
commit 085aff657a

View File

@ -181,7 +181,7 @@ def _convert_pref_type(p, pref_spec):
def _get_pref_default_value_from_config(name, pref_spec):
"""get default value store in application level config.
If not found, use defalut value hardcoded in pref_spec.
If not found, use default value hardcoded in pref_spec.
"""
# XXX va changer avec la nouvelle base
# search in scu.CONFIG
@ -1892,7 +1892,7 @@ class BasePreferences(object):
def get(self, formsemestre_id, name):
"""Returns preference value.
If global_lookup, when no value defined for this semestre, returns global value.
when no value defined for this semestre, returns global value.
"""
params = {
"dept_id": self.dept_id,
@ -1902,7 +1902,7 @@ class BasePreferences(object):
cnx = ndb.GetDBConnexion()
plist = self._editor.list(cnx, params)
if not plist:
del params["formsemestre_id"]
params["formsemestre_id"] = None
plist = self._editor.list(cnx, params)
if not plist:
return self.default[name]