From 5002afade17e2784a4624608e3c980166ca3fea0 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 2 Nov 2021 15:49:12 +0100 Subject: [PATCH] =?UTF-8?q?Acc=C3=A9l=C3=A8re=20acc=C3=A8s=20aux=20pr?= =?UTF-8?q?=C3=A9f=C3=A9rences?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_cache.py | 6 +++--- app/scodoc/sco_preferences.py | 18 +++--------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/app/scodoc/sco_cache.py b/app/scodoc/sco_cache.py index 53a26d77..9c20a213 100644 --- a/app/scodoc/sco_cache.py +++ b/app/scodoc/sco_cache.py @@ -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), diff --git a/app/scodoc/sco_preferences.py b/app/scodoc/sco_preferences.py index 92b00a67..d83ca14f 100644 --- a/app/scodoc/sco_preferences.py +++ b/app/scodoc/sco_preferences.py @@ -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]