forked from ScoDoc/ScoDoc
Accélère accès aux préférences
This commit is contained in:
parent
7589d4cc34
commit
5002afade1
@ -46,9 +46,9 @@
|
||||
# sco_cache.NotesTableCache.delete_many(formsemestre_id_list)
|
||||
#
|
||||
# Bulletins PDF:
|
||||
# sco_cache.PDFBulCache.get(formsemestre_id, version)
|
||||
# sco_cache.PDFBulCache.set(formsemestre_id, version, filename, pdfdoc)
|
||||
# sco_cache.PDFBulCache.delete(formsemestre_id) suppr. toutes les versions
|
||||
# sco_cache.SemBulletinsPDFCache.get(formsemestre_id, version)
|
||||
# sco_cache.SemBulletinsPDFCache.set(formsemestre_id, version, filename, pdfdoc)
|
||||
# sco_cache.SemBulletinsPDFCache.delete(formsemestre_id) suppr. toutes les versions
|
||||
|
||||
# Evaluations:
|
||||
# sco_cache.EvaluationCache.get(evaluation_id), set(evaluation_id, value), delete(evaluation_id),
|
||||
|
@ -1894,21 +1894,9 @@ class BasePreferences(object):
|
||||
"""Returns preference value.
|
||||
when no value defined for this semestre, returns global value.
|
||||
"""
|
||||
params = {
|
||||
"dept_id": self.dept_id,
|
||||
"name": name,
|
||||
"formsemestre_id": formsemestre_id,
|
||||
}
|
||||
cnx = ndb.GetDBConnexion()
|
||||
plist = self._editor.list(cnx, params)
|
||||
if not plist:
|
||||
params["formsemestre_id"] = None
|
||||
plist = self._editor.list(cnx, params)
|
||||
if not plist:
|
||||
return self.default[name]
|
||||
p = plist[0]
|
||||
_convert_pref_type(p, self.prefs_dict[name])
|
||||
return p["value"]
|
||||
if formsemestre_id in self.prefs:
|
||||
return self.prefs[formsemestre_id].get(name, self.prefs[None][name])
|
||||
return self.prefs[None][name]
|
||||
|
||||
def __contains__(self, item):
|
||||
return item in self.prefs[None]
|
||||
|
Loading…
Reference in New Issue
Block a user