diff --git a/README.md b/README.md index e28a92aa..b80ecd5b 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,7 @@ Sur une machine de DEV, lancer flask profile --host 0.0.0.0 --length 32 --profile-dir /opt/scodoc-data -le fichier `.prof` sera alors écrit dans `/opt/scoidoc-data` (on peut aussi utiliser `/tmp`). +le fichier `.prof` sera alors écrit dans `/opt/scodoc-data` (on peut aussi utiliser `/tmp`). Pour la visualisation, [snakeviz](https://jiffyclub.github.io/snakeviz/) est bien: 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] diff --git a/app/scodoc/sco_users.py b/app/scodoc/sco_users.py index eaf43494..de154857 100644 --- a/app/scodoc/sco_users.py +++ b/app/scodoc/sco_users.py @@ -46,7 +46,7 @@ from app.scodoc import sco_etud from app.scodoc import sco_excel from app.scodoc import sco_preferences from app.scodoc.gen_tables import GenTable -from app import log +from app import log, cache from app.scodoc.scolog import logdb import app.scodoc.sco_utils as scu @@ -226,6 +226,7 @@ def _user_list(user_name): return None +@cache.memoize(timeout=50) # seconds def user_info(user_name_or_id=None, user=None): """Dict avec infos sur l'utilisateur (qui peut ne pas etre dans notre base). Si user_name est specifie (string ou id), interroge la BD. Sinon, user doit etre une instance diff --git a/app/views/scolar.py b/app/views/scolar.py index a3a91303..79e9d198 100644 --- a/app/views/scolar.py +++ b/app/views/scolar.py @@ -306,6 +306,7 @@ sco_publish( @bp.route("/groups_view") @scodoc @permission_required_compat_scodoc7(Permission.ScoView) +# @permission_required(Permission.ScoView) @scodoc7func def groups_view( group_ids=(), @@ -319,7 +320,7 @@ def groups_view( formsemestre_id=None, ): return sco_groups_view.groups_view( - group_ids=(), + group_ids=group_ids, format=format, # Options pour listes: with_codes=with_codes,