From 512c00b2e7585c661b712b3b0fab75c18b67fdf4 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 16 Jun 2021 10:15:46 +0200 Subject: [PATCH] =?UTF-8?q?WIP=20am=C3=A9liore=20d=C3=A9corateur=20scodoc7?= =?UTF-8?q?=20pour=20appels=20internes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/decorators.py | 8 ++--- app/scodoc/pe_jurype.py | 2 +- app/scodoc/sco_edit_formation.py | 2 +- app/scodoc/sco_edit_module.py | 4 +-- app/scodoc/sco_export_results.py | 2 +- app/scodoc/sco_formations.py | 5 ++-- app/scodoc/sco_formsemestre.py | 2 +- app/scodoc/sco_formsemestre_edit.py | 19 ++++++------ app/scodoc/sco_formsemestre_status.py | 2 +- app/scodoc/sco_pvjury.py | 2 +- app/templates/main/index.html | 7 +++-- app/views/__init__.py | 2 +- app/views/entreprises.py | 42 +++++++++++++-------------- app/views/essais.py | 16 +++++++++- app/views/notes.py | 2 +- 15 files changed, 66 insertions(+), 51 deletions(-) diff --git a/app/decorators.py b/app/decorators.py index e4867cd21..a14c3aff3 100644 --- a/app/decorators.py +++ b/app/decorators.py @@ -124,17 +124,17 @@ def scodoc7func(context): If called via a route, this decorator setups a REQUEST object (emulating Zope2 REQUEST) and `g.scodoc_dept` if present in the argument (for routes like `//Scolarite/sco_exemple`). """ - assert not args # Détermine si on est appelé via une route ("toplevel") # ou par un appel de fonction python normal. top_level = not hasattr(g, "zrequest") - if top_level: - g.zrequest = None + if not top_level: + # ne "redécore" pas + return func(*args, **kwargs) # if "scodoc_dept" in kwargs: g.scodoc_dept = kwargs["scodoc_dept"] del kwargs["scodoc_dept"] - elif not hasattr(g, "scodoc_dept"): # if toplevel call + elif not hasattr(g, "scodoc_dept"): g.scodoc_dept = None # --- Emulate Zope's REQUEST REQUEST = ZRequest() diff --git a/app/scodoc/pe_jurype.py b/app/scodoc/pe_jurype.py index d0c5bae3a..c9f86ad38 100644 --- a/app/scodoc/pe_jurype.py +++ b/app/scodoc/pe_jurype.py @@ -66,7 +66,7 @@ def comp_nom_semestre_dans_parcours(context, sem): """Le nom a afficher pour titrer un semestre par exemple: "semestre 2 FI 2015" """ - F = context.Notes.formation_list(args={"formation_id": sem["formation_id"]})[0] + F = context.formation_list(args={"formation_id": sem["formation_id"]})[0] parcours = sco_codes_parcours.get_parcours_from_code(F["type_parcours"]) return "%s %s %s %s" % ( parcours.SESSION_NAME, # eg "semestre" diff --git a/app/scodoc/sco_edit_formation.py b/app/scodoc/sco_edit_formation.py index 845c3cb79..b21fa9bbc 100644 --- a/app/scodoc/sco_edit_formation.py +++ b/app/scodoc/sco_edit_formation.py @@ -245,7 +245,7 @@ def do_formation_create(context, args, REQUEST): if args.has_key("formation_code") and not args["formation_code"]: del args["formation_code"] # - r = _formationEditor.create(cnx, args) + r = sco_formations._formationEditor.create(cnx, args) sco_news.add( context, diff --git a/app/scodoc/sco_edit_module.py b/app/scodoc/sco_edit_module.py index e2847b319..56f49fe85 100644 --- a/app/scodoc/sco_edit_module.py +++ b/app/scodoc/sco_edit_module.py @@ -422,9 +422,7 @@ def module_list(context, formation_id, REQUEST=None): % F, '