From ea09f18377276fe6e40817fdcf906afb00130287 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 14 Jun 2021 18:08:52 +0200 Subject: [PATCH] WIP refactoring: menus --- app/scodoc/ZScoDoc.py | 2 +- app/scodoc/htmlutils.py | 15 +- app/scodoc/mails.py | 2 +- app/scodoc/notes_log.py | 2 +- app/scodoc/sco_bulletins.py | 89 +++++++--- app/scodoc/sco_edit_formation.py | 4 +- app/scodoc/sco_find_etud.py | 8 +- app/scodoc/sco_formsemestre_custommenu.py | 15 +- app/scodoc/sco_formsemestre_status.py | 195 +++++++++++++--------- app/scodoc/sco_moduleimpl_inscriptions.py | 2 +- app/scodoc/sco_moduleimpl_status.py | 40 +++-- app/scodoc/sco_page_etud.py | 60 +++---- app/scodoc/sco_portal_apogee.py | 4 +- app/scodoc/sco_pvpdf.py | 2 +- app/scodoc/sco_saisie_notes.py | 16 +- app/scodoc/sco_trombino.py | 13 +- app/scodoc/sco_up_to_date.py | 2 +- app/scodoc/sco_zope.py | 2 - app/scodoc/scolars.py | 4 +- app/views/notes.py | 12 +- app/views/scolar.py | 6 +- config.py | 2 + scodoc.py | 3 + 23 files changed, 293 insertions(+), 207 deletions(-) diff --git a/app/scodoc/ZScoDoc.py b/app/scodoc/ZScoDoc.py index 222e11571..68ffa34d9 100644 --- a/app/scodoc/ZScoDoc.py +++ b/app/scodoc/ZScoDoc.py @@ -803,7 +803,7 @@ ErrorType: %(error_type)s last_dept = None last_date = None for (dept, etuds) in depts_etud: - dept.Scolarite.fillEtudsInfo(etuds) + scolars.fillEtudsInfo(self, etuds) etud = etuds[0] if etud["sems"]: if (not last_date) or (etud["sems"][0]["date_fin_iso"] > last_date): diff --git a/app/scodoc/htmlutils.py b/app/scodoc/htmlutils.py index f75d9ccf1..c608020e2 100644 --- a/app/scodoc/htmlutils.py +++ b/app/scodoc/htmlutils.py @@ -27,6 +27,7 @@ """Various HTML generation functions """ +from flask import g, url_for import listhistogram @@ -71,13 +72,14 @@ def histogram_notes(notes): return "\n".join(D) -def make_menu(title, items, css_class="", base_url="", alone=False): +def make_menu(title, items, css_class="", alone=False): """HTML snippet to render a simple drop down menu. items is a list of dicts: { 'title' : - 'url' : + 'endpoint' : flask endpoint (name of the function) + 'args' : url query args 'id' : - 'attr' : "" # optionnal html attributes + 'attr' : "" # optional html attributes 'enabled' : # True by default 'helpmsg' : 'submenu' : [ list of sub-items ] @@ -96,10 +98,11 @@ def make_menu(title, items, css_class="", base_url="", alone=False): li_id = 'id="%s" ' % the_id else: li_id = "" - if base_url and "url" in item: - item["urlq"] = base_url + item["url"] + if "endpoint" in items: + args = item.get("args", {}) + item["urlq"] = url_for(endpoint, scodoc_dept=g.scodoc_dept, **args) else: - item["urlq"] = item.get("url", "#") + item["urlq"] = "#" item["attr"] = item.get("attr", "") submenu = item.get("submenu", None) H.append( diff --git a/app/scodoc/mails.py b/app/scodoc/mails.py index 6a1944b7c..69d4b63cc 100644 --- a/app/scodoc/mails.py +++ b/app/scodoc/mails.py @@ -118,7 +118,7 @@ def _report_request(context, REQUEST, fmt="txt"): HTTP_USER_AGENT=HTTP_USER_AGENT, form=REQUEST.get("form", ""), HTTP_X_FORWARDED_FOR=REQUEST.get("HTTP_X_FORWARDED_FOR", ""), - svn_version=scu.get_svn_version(context.file_path), + svn_version=scu.get_svn_version(scu.SCO_SRC_DIR), SCOVERSION=VERSION.SCOVERSION, ) txt = ( diff --git a/app/scodoc/notes_log.py b/app/scodoc/notes_log.py index 0cbbb92e1..2f19c320c 100644 --- a/app/scodoc/notes_log.py +++ b/app/scodoc/notes_log.py @@ -21,7 +21,6 @@ from email.MIMEBase import MIMEBase # pylint: disable=no-name-in-module,import- from email.Header import Header # pylint: disable=no-name-in-module,import-error from email import Encoders # pylint: disable=no-name-in-module,import-error -import mails # Simple & stupid file logguer, used only to debug # (logging to SQL is done in scolog) @@ -113,6 +112,7 @@ def retreive_dept(): # Alarms by email: def sendAlarm(context, subj, txt): import sco_utils + import mails msg = MIMEMultipart() subj = Header(subj, sco_utils.SCO_ENCODING) diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py index cbad07543..257db2e5f 100644 --- a/app/scodoc/sco_bulletins.py +++ b/app/scodoc/sco_bulletins.py @@ -1090,14 +1090,14 @@ def _formsemestre_bulletinetud_header_html( H.append('' % (v, selected, e)) H.append("""""") # Menu - url = REQUEST.URL0 + endpoint = "notes.formsemestre_bulletinetud" qurl = urllib.quote_plus(url + "?" + REQUEST.QUERY_STRING) menuBul = [ { "title": "Réglages bulletins", - "url": "formsemestre_edit_options?formsemestre_id=%s&target_url=%s" - % (formsemestre_id, qurl), + "endpoint": "notes.formsemestre_edit_options", + "args": {"formsemestre_id": formsemestre_id, "target_url": qurl}, "enabled": (uid in sem["responsables"]) or authuser.has_permission(Permission.ScoImplement, context), }, @@ -1106,15 +1106,23 @@ def _formsemestre_bulletinetud_header_html( % sco_bulletins_generator.bulletin_get_class_name_displayed( context, formsemestre_id ), - "url": url - + "?formsemestre_id=%s&etudid=%s&format=pdf&version=%s" - % (formsemestre_id, etudid, version), + "endpoint": endpoint, + "args": { + "formsemestre_id": formsemestre_id, + "etudid": etudid, + "version": version, + "format": "pdf", + }, }, { "title": "Envoi par mail à %s" % etud["email"], - "url": url - + "?formsemestre_id=%s&etudid=%s&format=pdfmail&version=%s" - % (formsemestre_id, etudid, version), + "endpoint": endpoint, + "args": { + "formsemestre_id": formsemestre_id, + "etudid": etudid, + "version": version, + "format": "pdfmail", + }, "enabled": etud["email"] and can_send_bulletin_by_mail( context, formsemestre_id, REQUEST @@ -1122,9 +1130,14 @@ def _formsemestre_bulletinetud_header_html( }, { "title": "Envoi par mail à %s (adr. personnelle)" % etud["emailperso"], - "url": url - + "?formsemestre_id=%s&etudid=%s&format=pdfmail&version=%s&prefer_mail_perso=1" - % (formsemestre_id, etudid, version), + "endpoint": endpoint, + "args": { + "formsemestre_id": formsemestre_id, + "etudid": etudid, + "version": version, + "format": "pdfmail", + "prefer_mail_perso": 1, + }, "enabled": etud["emailperso"] and can_send_bulletin_by_mail( context, formsemestre_id, REQUEST @@ -1132,14 +1145,21 @@ def _formsemestre_bulletinetud_header_html( }, { "title": "Version XML", - "url": url - + "?formsemestre_id=%s&etudid=%s&format=xml&version=%s" - % (formsemestre_id, etudid, version), + "endpoint": endpoint, + "args": { + "formsemestre_id": formsemestre_id, + "etudid": etudid, + "version": version, + "format": "xml", + }, }, { "title": "Ajouter une appréciation", - "url": "appreciation_add_form?etudid=%s&formsemestre_id=%s" - % (etudid, formsemestre_id), + "endpoint": "notes.appreciation_add_form", + "args": { + "formsemestre_id": formsemestre_id, + "etudid": etudid, + }, "enabled": ( (authuser in sem["responsables"]) or (authuser.has_permission(Permission.ScoEtudInscrit, context)) @@ -1147,32 +1167,47 @@ def _formsemestre_bulletinetud_header_html( }, { "title": "Enregistrer un semestre effectué ailleurs", - "url": "formsemestre_ext_create_form?etudid=%s&formsemestre_id=%s" - % (etudid, formsemestre_id), + "endpoint": "notes.formsemestre_ext_create_form", + "args": { + "formsemestre_id": formsemestre_id, + "etudid": etudid, + }, "enabled": authuser.has_permission(Permission.ScoImplement, context), }, { "title": "Enregistrer une validation d'UE antérieure", - "url": "formsemestre_validate_previous_ue?etudid=%s&formsemestre_id=%s" - % (etudid, formsemestre_id), + "endpoint": "notes.formsemestre_validate_previous_ue", + "args": { + "formsemestre_id": formsemestre_id, + "etudid": etudid, + }, "enabled": context._can_validate_sem(REQUEST, formsemestre_id), }, { "title": "Enregistrer note d'une UE externe", - "url": "external_ue_create_form?etudid=%s&formsemestre_id=%s" - % (etudid, formsemestre_id), + "endpoint": "notes.external_ue_create_form", + "args": { + "formsemestre_id": formsemestre_id, + "etudid": etudid, + }, "enabled": context._can_validate_sem(REQUEST, formsemestre_id), }, { "title": "Entrer décisions jury", - "url": "formsemestre_validation_etud_form?formsemestre_id=%s&etudid=%s" - % (formsemestre_id, etudid), + "endpoint": "notes.formsemestre_validation_etud_form", + "args": { + "formsemestre_id": formsemestre_id, + "etudid": etudid, + }, "enabled": context._can_validate_sem(REQUEST, formsemestre_id), }, { "title": "Editer PV jury", - "url": "formsemestre_pvjury_pdf?formsemestre_id=%s&etudid=%s" - % (formsemestre_id, etudid), + "endpoint": "notes.formsemestre_pvjury_pdf", + "args": { + "formsemestre_id": formsemestre_id, + "etudid": etudid, + }, "enabled": True, }, ] diff --git a/app/scodoc/sco_edit_formation.py b/app/scodoc/sco_edit_formation.py index ec9ccb391..0c915e0fe 100644 --- a/app/scodoc/sco_edit_formation.py +++ b/app/scodoc/sco_edit_formation.py @@ -35,7 +35,7 @@ from TrivialFormulator import TrivialFormulator, TF, tf_error_message import sco_codes_parcours import sco_formsemestre from sco_exceptions import ScoValueError -import sco_formation +import sco_formations def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST=None): @@ -271,7 +271,7 @@ def do_formation_edit(context, args): del args["formation_code"] cnx = context.GetDBConnexion() - sco_formation._formationEditor.edit(cnx, args) + sco_formations._formationEditor.edit(cnx, args) # Invalide les semestres utilisant cette formation: for sem in sco_formsemestre.do_formsemestre_list( diff --git a/app/scodoc/sco_find_etud.py b/app/scodoc/sco_find_etud.py index d93be419c..c43fb896d 100644 --- a/app/scodoc/sco_find_etud.py +++ b/app/scodoc/sco_find_etud.py @@ -120,8 +120,10 @@ def search_etud_in_dept(context, expnom="", REQUEST=None): etuds = [] # si expnom est trop court, n'affiche rien if len(etuds) == 1: - # va directement a la destination - return context.ficheEtud(etudid=etuds[0]["etudid"], REQUEST=REQUEST) + # va directement a la fiche + return REQUEST.RESPONSE.redirect( + context.NotesURL() + "/ficheEtud?etudid=" + etuds[0]["etudid"] + ) H = [ html_sco_header.sco_header( @@ -199,7 +201,7 @@ def search_etuds_infos(context, expnom=None, code_nip=None, REQUEST=None): etuds = scolars.etudident_list(cnx, args={"code_nip": code_nip}) else: etuds = [] - context.fillEtudsInfo(etuds) + scolars.fillEtudsInfo(context, etuds) return etuds diff --git a/app/scodoc/sco_formsemestre_custommenu.py b/app/scodoc/sco_formsemestre_custommenu.py index cff50054f..ce6b98734 100644 --- a/app/scodoc/sco_formsemestre_custommenu.py +++ b/app/scodoc/sco_formsemestre_custommenu.py @@ -57,7 +57,7 @@ def formsemestre_custommenu_get(context, formsemestre_id): return vals -def formsemestre_custommenu_html(context, formsemestre_id, base_url=""): +def formsemestre_custommenu_html(context, formsemestre_id): "HTML code for custom menu" menu = [] # Calendrier électronique ? @@ -69,9 +69,8 @@ def formsemestre_custommenu_html(context, formsemestre_id, base_url=""): menu.append( { "title": "Modifier ce menu...", - "url": base_url - + "formsemestre_custommenu_edit?formsemestre_id=" - + formsemestre_id, + "endpoint": "notes.formsemestre_custommenu_edit", + "args": {"formsemestre_id": formsemestre_id}, } ) return sco_formsemestre_status.htmlutils.make_menu("Liens", menu) @@ -84,7 +83,9 @@ def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None): context.NotesURL() + "/formsemestre_status?formsemestre_id=%s" % formsemestre_id ) H = [ - html_sco_header.html_sem_header(context, REQUEST, "Modification du menu du semestre ", sem), + html_sco_header.html_sem_header( + context, REQUEST, "Modification du menu du semestre ", sem + ), """

Ce menu, spécifique à chaque semestre, peut être utilisé pour placer des liens vers vos applications préférées.

Procédez en plusieurs fois si vous voulez ajouter plusieurs items.

""", ] @@ -127,7 +128,9 @@ def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None): name="tf", ) if tf[0] == 0: - return "\n".join(H) + "\n" + tf[1] + html_sco_header.sco_footer(context, REQUEST) + return ( + "\n".join(H) + "\n" + tf[1] + html_sco_header.sco_footer(context, REQUEST) + ) elif tf[0] == -1: return REQUEST.RESPONSE.redirect(dest_url) else: diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index bac3529de..f241b1f7b 100644 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -76,54 +76,56 @@ def defMenuStats(context, formsemestre_id): return [ { "title": "Statistiques...", - "url": "formsemestre_report_counts?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_report_counts", + "args": {"formsemestre_id": formsemestre_id}, }, { "title": "Suivi de cohortes", - "url": "formsemestre_suivi_cohorte?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_suivi_cohorte", + "args": {"formsemestre_id": formsemestre_id}, "enabled": True, }, { "title": "Graphe des parcours", - "url": "formsemestre_graph_parcours?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_graph_parcours", + "args": {"formsemestre_id": formsemestre_id}, "enabled": scu.WITH_PYDOT, }, { "title": "Codes des parcours", - "url": "formsemestre_suivi_parcours?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_suivi_parcours", + "args": {"formsemestre_id": formsemestre_id}, "enabled": True, }, { "title": "Lycées d'origine", - "url": "formsemestre_etuds_lycees?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_etuds_lycees", + "args": {"formsemestre_id": formsemestre_id}, "enabled": True, }, { "title": 'Table "poursuite"', - "url": "formsemestre_poursuite_report?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_poursuite_report", + "args": {"formsemestre_id": formsemestre_id}, "enabled": True, }, { "title": "Documents Avis Poursuite Etudes", - "url": "pe_view_sem_recap?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.pe_view_sem_recap", + "args": {"formsemestre_id": formsemestre_id}, + "enabled": True, + }, + { + "title": 'Table "débouchés"', + "endpoint": "notes.report_debouche_date", "enabled": True, }, - {"title": 'Table "débouchés"', "url": "report_debouche_date", "enabled": True}, { "title": "Estimation du coût de la formation", - "url": "formsemestre_estim_cost?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_estim_cost?formsemestre_id", + "args": {"formsemestre_id": formsemestre_id}, "enabled": True, }, - # { 'title' : 'experimental sub', - # 'submenu' : [ - # { 'title' : 'sous 1', - # 'url' : '#' }, - # { 'title' : 'sous 2', - # 'url' : '#' }, - # { 'title' : 'sous 3', - # 'url' : '#' }, - # ] - # }, ] @@ -142,20 +144,23 @@ def formsemestre_status_menubar(context, sem, REQUEST): menuSemestre = [ { "title": "Tableau de bord", - "url": "formsemestre_status?formsemestre_id=%(formsemestre_id)s" % sem, + "endpoint": "notes.formsemestre_status", + "args": {"formsemestre_id": formsemestre_id}, "enabled": True, "helpmsg": "Tableau de bord du semestre", }, { "title": "Voir la formation %(acronyme)s (v%(version)s)" % F, - "url": "ue_list?formation_id=%(formation_id)s" % sem, + "endpoint": "notes.ue_list", + "args": {"formation_id": sem["formation_id"]}, "enabled": True, "helpmsg": "Tableau de bord du semestre", }, { "title": "Modifier le semestre", - "url": "formsemestre_editwithmodules?formation_id=%(formation_id)s&formsemestre_id=%(formsemestre_id)s" + "endpoint": "notes.formsemestre_editwithmodules?formation_id=%(formation_id)s&formsemestre_id=%(formsemestre_id)s" % sem, + "args": {"formsemestre_id": formsemestre_id}, "enabled": ( authuser.has_permission(Permission.ScoImplement, context) or ( @@ -168,8 +173,8 @@ def formsemestre_status_menubar(context, sem, REQUEST): }, { "title": "Préférences du semestre", - "url": "formsemestre_edit_preferences?formsemestre_id=%(formsemestre_id)s" - % sem, + "endpoint": "notes.formsemestre_edit_preferences", + "args": {"formsemestre_id": formsemestre_id}, "enabled": ( authuser.has_permission(Permission.ScoImplement, context) or ( @@ -182,64 +187,71 @@ def formsemestre_status_menubar(context, sem, REQUEST): }, { "title": "Réglages bulletins", - "url": "formsemestre_edit_options?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_edit_options", + "args": {"formsemestre_id": formsemestre_id}, "enabled": (uid in sem["responsables"]) or authuser.has_permission(Permission.ScoImplement, context), "helpmsg": "Change les options", }, { "title": change_lock_msg, - "url": "formsemestre_change_lock?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_change_lock", + "args": {"formsemestre_id": formsemestre_id}, "enabled": (uid in sem["responsables"]) or authuser.has_permission(Permission.ScoImplement, context), "helpmsg": "", }, { "title": "Description du semestre", - "url": "formsemestre_description?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_description", + "args": {"formsemestre_id": formsemestre_id}, "enabled": True, "helpmsg": "", }, { "title": "Vérifier absences aux évaluations", - "url": "formsemestre_check_absences_html?formsemestre_id=" - + formsemestre_id, + "endpoint": "notes.formsemestre_check_absences_html", + "args": {"formsemestre_id": formsemestre_id}, "enabled": True, "helpmsg": "", }, { "title": "Lister tous les enseignants", - "url": "formsemestre_enseignants_list?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_enseignants_list", + "args": {"formsemestre_id": formsemestre_id}, "enabled": True, "helpmsg": "", }, { "title": "Cloner ce semestre", - "url": "formsemestre_clone?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_clone", + "args": {"formsemestre_id": formsemestre_id}, "enabled": authuser.has_permission(Permission.ScoImplement, context), "helpmsg": "", }, { "title": "Associer à une nouvelle version du programme", - "url": "formsemestre_associate_new_version?formsemestre_id=" - + formsemestre_id, + "endpoint": "notes.formsemestre_associate_new_version", + "args": {"formsemestre_id": formsemestre_id}, "enabled": authuser.has_permission(Permission.ScoChangeFormation, context) and (sem["etat"] == "1"), "helpmsg": "", }, { "title": "Supprimer ce semestre", - "url": "formsemestre_delete?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_delete", + "args": {"formsemestre_id": formsemestre_id}, "enabled": authuser.has_permission(Permission.ScoImplement, context), "helpmsg": "", }, ] # debug : - if uid == "root" or uid[:7] == "viennet": + if app.config["ENV"] == "development": menuSemestre.append( { "title": "Check integrity", - "url": "check_sem_integrity?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.check_sem_integrity", + "args": {"formsemestre_id": formsemestre_id}, "enabled": True, } ) @@ -247,79 +259,82 @@ def formsemestre_status_menubar(context, sem, REQUEST): menuInscriptions = [ { "title": "Voir les inscriptions aux modules", - "url": "moduleimpl_inscriptions_stats?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.moduleimpl_inscriptions_stats", + "args": {"formsemestre_id": formsemestre_id}, } ] menuInscriptions += [ { "title": "Passage des étudiants depuis d'autres semestres", - "url": "formsemestre_inscr_passage?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_inscr_passage", + "args": {"formsemestre_id": formsemestre_id}, "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context) and (sem["etat"] == "1"), }, { "title": "Synchroniser avec étape Apogée", - "url": "formsemestre_synchro_etuds?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_synchro_etuds", + "args": {"formsemestre_id": formsemestre_id}, "enabled": authuser.has_permission(Permission.ScoView, context) and sco_preferences.get_preference(context, "portal_url") and (sem["etat"] == "1"), }, { "title": "Inscrire un étudiant", - "url": "formsemestre_inscription_with_modules_etud?formsemestre_id=" - + formsemestre_id, + "endpoint": "notes.formsemestre_inscription_with_modules_etud", + "args": {"formsemestre_id": formsemestre_id}, "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context) and (sem["etat"] == "1"), }, { "title": "Importer des étudiants dans ce semestre (table Excel)", - "url": "form_students_import_excel?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.form_students_import_excel", + "args": {"formsemestre_id": formsemestre_id}, "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context) and (sem["etat"] == "1"), }, { "title": "Import/export des données admission", - "url": "form_students_import_infos_admissions?formsemestre_id=" - + formsemestre_id, + "endpoint": "notes.form_students_import_infos_admissions", + "args": {"formsemestre_id": formsemestre_id}, "enabled": authuser.has_permission(Permission.ScoView, context), }, { "title": "Resynchroniser données identité", - "url": "formsemestre_import_etud_admission?formsemestre_id=" - + formsemestre_id, + "endpoint": "notes.formsemestre_import_etud_admission", + "args": {"formsemestre_id": formsemestre_id}, "enabled": authuser.has_permission(Permission.ScoEtudChangeAdr, context) and sco_preferences.get_preference(context, "portal_url"), }, { "title": "Exporter table des étudiants", - "url": "groups_view?format=allxls&group_ids=" - + sco_groups.get_default_group( - context, formsemestre_id, fix_if_missing=True, REQUEST=REQUEST - ), + "endpoint": "notes.groups_view", + "args": { + "format": allxls, + "group_ids": sco_groups.get_default_group( + context, formsemestre_id, fix_if_missing=True, REQUEST=REQUEST + ), + }, }, { "title": "Vérifier inscriptions multiples", - "url": "formsemestre_inscrits_ailleurs?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_inscrits_ailleurs", + "args": {"formsemestre_id": formsemestre_id}, }, ] menuGroupes = [ { "title": "Listes, photos, feuilles...", - "url": "groups_view?formsemestre_id=" + formsemestre_id, - "enabled": True, - "helpmsg": "Accès aux listes des groupes d'étudiants", - }, - # On laisse l'accès à l'ancienne page, le temps de tester - { - "title": "Listes (ancienne page)", - "url": "formsemestre_lists?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.groups_view", + "args": {"formsemestre_id": formsemestre_id}, "enabled": True, "helpmsg": "Accès aux listes des groupes d'étudiants", }, { "title": "Créer/modifier les partitions...", - "url": "editPartitionForm?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.editPartitionForm", + "args": {"formsemestre_id": formsemestre_id}, "enabled": sco_groups.can_change_groups(context, REQUEST, formsemestre_id), }, ] @@ -335,7 +350,8 @@ def formsemestre_status_menubar(context, sem, REQUEST): submenu.append( { "title": "%s" % partition["partition_name"], - "url": "affectGroups?partition_id=%s" % partition["partition_id"], + "endpoint": "notes.affectGroups", + "args": {"partition_id": partition["partition_id"]}, "enabled": enabled, } ) @@ -346,60 +362,74 @@ def formsemestre_status_menubar(context, sem, REQUEST): menuNotes = [ { "title": "Tableau des moyennes (et liens bulletins)", - "url": "formsemestre_recapcomplet?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_recapcomplet", + "args": {"formsemestre_id": formsemestre_id}, }, { "title": "Saisie des notes", - "url": "formsemestre_status?formsemestre_id=%(formsemestre_id)s" % sem, + "endpoint": "notes.formsemestre_status", + "args": {"formsemestre_id": formsemestre_id}, "enabled": True, "helpmsg": "Tableau de bord du semestre", }, { "title": "Classeur PDF des bulletins", - "url": "formsemestre_bulletins_pdf_choice?formsemestre_id=" - + formsemestre_id, + "endpoint": "notes.formsemestre_bulletins_pdf_choice", + "args": {"formsemestre_id": formsemestre_id}, "helpmsg": "PDF regroupant tous les bulletins", }, { "title": "Envoyer à chaque étudiant son bulletin par e-mail", - "url": "formsemestre_bulletins_mailetuds_choice?formsemestre_id=" - + formsemestre_id, + "endpoint": "notes.formsemestre_bulletins_mailetuds_choice", + "args": {"formsemestre_id": formsemestre_id}, "enabled": sco_bulletins.can_send_bulletin_by_mail( context, formsemestre_id, REQUEST ), }, { "title": "Calendrier des évaluations", - "url": "formsemestre_evaluations_cal?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_evaluations_cal", + "args": {"formsemestre_id": formsemestre_id}, }, { "title": "Lister toutes les saisies de notes", - "url": "formsemestre_list_saisies_notes?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_list_saisies_notes", + "args": {"formsemestre_id": formsemestre_id}, }, ] menuJury = [ { "title": "Voir les décisions du jury", - "url": "formsemestre_pvjury?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_pvjury", + "args": {"formsemestre_id": formsemestre_id}, }, { "title": "Générer feuille préparation Jury", - "url": "feuille_preparation_jury?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.feuille_preparation_jury", + "args": {"formsemestre_id": formsemestre_id}, }, { "title": "Saisie des décisions du jury", - "url": "formsemestre_recapcomplet?modejury=1&hidemodules=1&hidebac=1&pref_override=0&formsemestre_id=" - + formsemestre_id, + "endpoint": "notes.formsemestre_recapcomplet", + "args": { + "formsemestre_id": formsemestre_id, + "modejury": 1, + "hidemodules": 1, + "hidebac": 1, + "pref_override": 0, + }, "enabled": context._can_validate_sem(REQUEST, formsemestre_id), }, { "title": "Editer les PV et archiver les résultats", - "url": "formsemestre_archive?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_archive", + "args": {"formsemestre_id": formsemestre_id}, "enabled": context._can_edit_pv(REQUEST, formsemestre_id), }, { "title": "Documents archivés", - "url": "formsemestre_list_archives?formsemestre_id=" + formsemestre_id, + "endpoint": "notes.formsemestre_list_archives", + "args": {"formsemestre_id": formsemestre_id}, "enabled": sco_archives.PVArchive.list_obj_archives( context, formsemestre_id ), @@ -407,17 +437,16 @@ def formsemestre_status_menubar(context, sem, REQUEST): ] menuStats = defMenuStats(context, formsemestre_id) - base_url = context.absolute_url() + "/" # context must be Notes H = [ #
', '
    ', - htmlutils.make_menu("Semestre", menuSemestre, base_url=base_url), - htmlutils.make_menu("Inscriptions", menuInscriptions, base_url=base_url), - htmlutils.make_menu("Groupes", menuGroupes, base_url=base_url), - htmlutils.make_menu("Notes", menuNotes, base_url=base_url), - htmlutils.make_menu("Jury", menuJury, base_url=base_url), - htmlutils.make_menu("Statistiques", menuStats, base_url=base_url), - formsemestre_custommenu_html(context, formsemestre_id, base_url=base_url), + htmlutils.make_menu("Semestre", menuSemestre), + htmlutils.make_menu("Inscriptions", menuInscriptions), + htmlutils.make_menu("Groupes", menuGroupes), + htmlutils.make_menu("Notes", menuNotes), + htmlutils.make_menu("Jury", menuJury), + htmlutils.make_menu("Statistiques", menuStats), + formsemestre_custommenu_html(context, formsemestre_id), "
", #'
' ] diff --git a/app/scodoc/sco_moduleimpl_inscriptions.py b/app/scodoc/sco_moduleimpl_inscriptions.py index 30e2905fa..5e8d34a07 100644 --- a/app/scodoc/sco_moduleimpl_inscriptions.py +++ b/app/scodoc/sco_moduleimpl_inscriptions.py @@ -210,7 +210,7 @@ def _make_menu(context, partitions, title="", check="true"): ) return ( '' - + htmlutils.make_menu(title, items, base_url=context.absolute_url(), alone=True) + + htmlutils.make_menu(title, items, alone=True) + "" ) diff --git a/app/scodoc/sco_moduleimpl_status.py b/app/scodoc/sco_moduleimpl_status.py index 450aa198d..03c8db3e7 100644 --- a/app/scodoc/sco_moduleimpl_status.py +++ b/app/scodoc/sco_moduleimpl_status.py @@ -28,7 +28,6 @@ """Tableau de bord module """ import time -import urllib import sco_utils as scu from sco_utils import ( @@ -80,21 +79,30 @@ def moduleimpl_evaluation_menu(context, evaluation_id, nbnotes=0, REQUEST=None): menuEval = [ { "title": "Saisir notes", - "url": "saisie_notes?evaluation_id=" + evaluation_id, + "endpoint": "notes.saisie_notes", + "args": { + "evaluation_id": evaluation_id, + }, "enabled": sco_saisie_notes.can_edit_notes( context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"] ), }, { "title": "Modifier évaluation", - "url": "evaluation_edit?evaluation_id=" + evaluation_id, + "endpoint": "notes.evaluation_edit", + "args": { + "evaluation_id": evaluation_id, + }, "enabled": sco_saisie_notes.can_edit_notes( context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False ), }, { "title": sup_label, - "url": "evaluation_delete?evaluation_id=" + evaluation_id, + "endpoint": "notes.evaluation_delete", + "args": { + "evaluation_id": evaluation_id, + }, "enabled": nbnotes == 0 and sco_saisie_notes.can_edit_notes( context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False @@ -102,19 +110,28 @@ def moduleimpl_evaluation_menu(context, evaluation_id, nbnotes=0, REQUEST=None): }, { "title": "Supprimer toutes les notes", - "url": "evaluation_suppress_alln?evaluation_id=" + evaluation_id, + "endpoint": "notes.evaluation_suppress_alln", + "args": { + "evaluation_id": evaluation_id, + }, "enabled": sco_saisie_notes.can_edit_notes( context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False ), }, { "title": "Afficher les notes", - "url": "evaluation_listenotes?evaluation_id=" + evaluation_id, + "endpoint": "notes.evaluation_listenotes", + "args": { + "evaluation_id": evaluation_id, + }, "enabled": nbnotes > 0, }, { "title": "Placement étudiants", - "url": "placement_eval_selectetuds?evaluation_id=" + evaluation_id, + "endpoint": "notes.placement_eval_selectetuds", + "args": { + "evaluation_id": evaluation_id, + }, "enabled": nbnotes == 0 and sco_saisie_notes.can_edit_notes( context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"] @@ -122,13 +139,16 @@ def moduleimpl_evaluation_menu(context, evaluation_id, nbnotes=0, REQUEST=None): }, { "title": "Absences ce jour", - "url": "Absences/EtatAbsencesDate?date=%s&group_ids=%s" - % (urllib.quote(E["jour"], safe=""), group_id), + "endpoint": "absences.EtatAbsencesDate?date=%s&group_ids=%s" + % (endpointlib.quote(E["jour"], safe=""), group_id), "enabled": E["jour"], }, { "title": "Vérifier notes vs absents", - "url": "evaluation_check_absences_html?evaluation_id=%s" % (evaluation_id), + "endpoint": "notes.evaluation_check_absences_html", + "args": { + "evaluation_id": evaluation_id, + }, "enabled": nbnotes > 0 and E["jour"], }, ] diff --git a/app/scodoc/sco_page_etud.py b/app/scodoc/sco_page_etud.py index c39ca695b..59dba8121 100644 --- a/app/scodoc/sco_page_etud.py +++ b/app/scodoc/sco_page_etud.py @@ -75,70 +75,61 @@ def _menuScolarite(context, authuser, sem, etudid): if ins["etat"] != "D": dem_title = "Démission" - dem_url = "formDem?etudid=%(etudid)s&formsemestre_id=%(formsemestre_id)s" % args + dem_url = "formDem" else: dem_title = "Annuler la démission" - dem_url = ( - "doCancelDem?etudid=%(etudid)s&formsemestre_id=%(formsemestre_id)s" % args - ) + dem_url = "doCancelDem" # Note: seul un etudiant inscrit (I) peut devenir défaillant. if ins["etat"] != sco_codes_parcours.DEF: def_title = "Déclarer défaillance" - def_url = "formDef?etudid=%(etudid)s&formsemestre_id=%(formsemestre_id)s" % args + def_url = "formDef" elif ins["etat"] == sco_codes_parcours.DEF: def_title = "Annuler la défaillance" - def_url = ( - "doCancelDef?etudid=%(etudid)s&formsemestre_id=%(formsemestre_id)s" % args - ) + def_url = "doCancelDef" def_enabled = ( (ins["etat"] != "D") and authuser.has_permission(Permission.ScoEtudInscrit, context) and not locked ) items = [ - # { 'title' : 'Changer de groupe', - # 'url' : 'formChangeGroup?etudid=%s&formsemestre_id=%s' % (etudid,ins['formsemestre_id']), - # 'enabled' : authuser.has_permission(Permission.ScoEtudChangeGroups,context) and not locked, - # }, { "title": dem_title, - "url": dem_url, + "endpoint": dem_url, + "args": args, "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context) and not locked, }, { "title": "Validation du semestre (jury)", - "url": "Notes/formsemestre_validation_etud_form?etudid=%(etudid)s&formsemestre_id=%(formsemestre_id)s" - % args, + "endpoint": "notes.formsemestre_validation_etud_form", + "args": args, "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context) and not locked, }, - {"title": def_title, "url": def_url, "enabled": def_enabled}, + {"title": def_title, "endpoint": def_url, "enabled": def_enabled}, { "title": "Inscrire à un module optionnel (ou au sport)", - "url": "Notes/formsemestre_inscription_option?formsemestre_id=%(formsemestre_id)s&etudid=%(etudid)s" - % args, + "endpoint": "notes.formsemestre_inscription_option", + "args": args, "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context) and not locked, }, { "title": "Désinscrire (en cas d'erreur)", - "url": "Notes/formsemestre_desinscription?formsemestre_id=%(formsemestre_id)s&etudid=%(etudid)s" - % args, + "endpoint": "notes.formsemestre_desinscription", "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context) and not locked, }, { "title": "Inscrire à un autre semestre", - "url": "Notes/formsemestre_inscription_with_modules_form?etudid=%(etudid)s" - % args, + "endpoint": "notes.formsemestre_inscription_with_modules_form", + "args": {"etudid": etudid}, "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context), }, { "title": "Enregistrer un semestre effectué ailleurs", - "url": "Notes/formsemestre_ext_create_form?formsemestre_id=%(formsemestre_id)s&etudid=%(etudid)s" - % args, + "endpoint": "notes.formsemestre_ext_create_form", "enabled": authuser.has_permission(Permission.ScoImplement, context), }, ] @@ -163,7 +154,7 @@ def ficheEtud(context, etudid=None, REQUEST=None): raise ScoValueError("Etudiant inexistant !") etud = etuds[0] etudid = etud["etudid"] - context.fillEtudsInfo([etud]) + scolars.fillEtudsInfo(context, [etud]) # info = etud info["ScoURL"] = context.ScoURL() @@ -510,35 +501,38 @@ def menus_etud(context, REQUEST=None): menuEtud = [ { "title": etud["nomprenom"], - "url": "ficheEtud?etudid=%(etudid)s" % etud, + "endpoint": "scolar.ficheEtud", + "args": {"etudid": etud["etudid"]}, "enabled": True, "helpmsg": "Fiche étudiant", }, { "title": "Changer la photo", - "url": "formChangePhoto?etudid=%(etudid)s" % etud, + "endpoint": "scolar.formChangePhoto", + "args": {"etudid": etud["etudid"]}, "enabled": authuser.has_permission(Permission.ScoEtudChangeAdr, context), }, { "title": "Changer les données identité/admission", - "url": "etudident_edit_form?etudid=%(etudid)s" % etud, + "endpoint": "scolar.etudident_edit_form", + "args": {"etudid": etud["etudid"]}, "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context), }, { "title": "Supprimer cet étudiant...", - "url": "etudident_delete?etudid=%(etudid)s" % etud, + "endpoint": "scolar.etudident_delete", + "args": {"etudid": etud["etudid"]}, "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context), }, { "title": "Voir le journal...", - "url": "showEtudLog?etudid=%(etudid)s" % etud, + "endpoint": "scolar.showEtudLog", + "args": {"etudid": etud["etudid"]}, "enabled": True, }, ] - return htmlutils.make_menu( - "Etudiant", menuEtud, base_url=context.absolute_url() + "/", alone=True - ) + return htmlutils.make_menu("Etudiant", menuEtud, alone=True) def etud_info_html(context, etudid, with_photo="1", REQUEST=None, debug=False): diff --git a/app/scodoc/sco_portal_apogee.py b/app/scodoc/sco_portal_apogee.py index 996c966c7..1b2f57c20 100644 --- a/app/scodoc/sco_portal_apogee.py +++ b/app/scodoc/sco_portal_apogee.py @@ -335,8 +335,8 @@ def get_etud_apogee(context, code_nip): def get_default_etapes(context): - """Liste par défaut: devrait etre lue d'un fichier de config""" - filename = context.file_path + "/config/default-etapes.txt" + """Liste par défaut, lue du fichier de config""" + filename = SCO_TOOLS_DIR + "/default-etapes.txt" log("get_default_etapes: reading %s" % filename) f = open(filename) etapes = {} diff --git a/app/scodoc/sco_pvpdf.py b/app/scodoc/sco_pvpdf.py index eb20a2588..515bc80f9 100644 --- a/app/scodoc/sco_pvpdf.py +++ b/app/scodoc/sco_pvpdf.py @@ -345,7 +345,7 @@ def pdf_lettres_individuelles( return "" # Ajoute infos sur etudiants etuds = [x["identite"] for x in dpv["decisions"]] - context.fillEtudsInfo(etuds) + scolars.fillEtudsInfo(context, etuds) # sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) prefs = sco_preferences.SemPreferences(context, formsemestre_id) diff --git a/app/scodoc/sco_saisie_notes.py b/app/scodoc/sco_saisie_notes.py index c3ceb6f77..d2e513f99 100644 --- a/app/scodoc/sco_saisie_notes.py +++ b/app/scodoc/sco_saisie_notes.py @@ -941,21 +941,23 @@ def saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None): { "title": "Saisie par fichier tableur", "id": "menu_saisie_tableur", - "url": "/saisie_notes_tableur?evaluation_id=%s&%s" - % (E["evaluation_id"], groups_infos.groups_query_args), + "endpoint": "notes.saisie_notes_tableur", + "args": { + "evaluation_id": E["evaluation_id"], + "group_ids": groups_infos.group_ids, + }, }, { "title": "Voir toutes les notes du module", - "url": "/evaluation_listenotes?moduleimpl_id=%s" - % E["moduleimpl_id"], + "endpoint": "notes.evaluation_listenotes", + "args": {"moduleimpl_id": E["moduleimpl_id"]}, }, { "title": "Effacer toutes les notes de cette évaluation", - "url": "/evaluation_suppress_alln?evaluation_id=%s" - % (E["evaluation_id"],), + "endpoint": "notes.evaluation_suppress_alln", + "args": {"evaluation_id": E["evaluation_id"]}, }, ], - base_url=context.absolute_url(), alone=True, ) ) diff --git a/app/scodoc/sco_trombino.py b/app/scodoc/sco_trombino.py index d34c1f5ed..c7619a6c8 100644 --- a/app/scodoc/sco_trombino.py +++ b/app/scodoc/sco_trombino.py @@ -104,16 +104,21 @@ def _trombino_html_header(context, REQUEST): def trombino_html(context, groups_infos, REQUEST=None): "HTML snippet for trombino (with title and menu)" - args = groups_infos.groups_query_args menuTrombi = [ - {"title": "Charger des photos...", "url": "photos_import_files_form?%s" % args}, + { + "title": "Charger des photos...", + "endpoint": "scolar.photos_import_files_form", + "args": {"group_ids": groups_infos.group_ids}, + }, { "title": "Obtenir archive Zip des photos", - "url": "trombino?%s&format=zip" % args, + "endpoint": "scolar.trombino", + "args": {"group_ids": groups_infos.group_ids, "format": "zip"}, }, { "title": "Recopier les photos depuis le portail", - "url": "trombino_copy_photos?%s" % args, + "endpoint": "scolar.trombino_copy_photos", + "args": {"group_ids": groups_infos.group_ids}, }, ] diff --git a/app/scodoc/sco_up_to_date.py b/app/scodoc/sco_up_to_date.py index df31f7feb..5175960fd 100644 --- a/app/scodoc/sco_up_to_date.py +++ b/app/scodoc/sco_up_to_date.py @@ -81,7 +81,7 @@ def is_up_to_date(context): # return _UP_TO_DATE, _UP_TO_DATE_MSG # last_stable_ver = get_last_stable_version() - # cur_ver = scu.get_svn_version(context.file_path) # in sco_utils + # cur_ver = scu.get_svn_version(scu.SCO_SRC_DIR) # in sco_utils # cur_ver2 = cur_ver # cur_ver_num = -1 # # Convert versions to integers: diff --git a/app/scodoc/sco_zope.py b/app/scodoc/sco_zope.py index 2e83e83e5..b780de44c 100644 --- a/app/scodoc/sco_zope.py +++ b/app/scodoc/sco_zope.py @@ -47,8 +47,6 @@ from Globals import Persistent from Globals import INSTANCE_HOME from Acquisition import Implicit -# where we exist on the file system -file_path = Globals.package_home(globals()) # Collect all security declarations (Zope2Flask) diff --git a/app/scodoc/scolars.py b/app/scodoc/scolars.py index 84b0231ac..9770f282d 100644 --- a/app/scodoc/scolars.py +++ b/app/scodoc/scolars.py @@ -29,7 +29,7 @@ """ import time -import mail +import mails import sco_utils as scu from sco_utils import SCO_ENCODING from sco_exceptions import ScoGenError, ScoValueError @@ -709,7 +709,7 @@ def create_etud(context, cnx, args={}, REQUEST=None): msg="creation initiale", ) etud = etudident_list(cnx, {"etudid": etudid})[0] - context.fillEtudsInfo([etud]) + fillEtudsInfo(context, [etud]) etud["url"] = "ficheEtud?etudid=%(etudid)s" % etud sco_news.add( context, diff --git a/app/views/notes.py b/app/views/notes.py index 767d8fac8..765b1fb46 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -264,11 +264,6 @@ sco_publish( sco_formsemestre_status.formsemestre_description, Permission.ScoView, ) -sco_publish( - "/formsemestre_lists", - sco_formsemestre_status.formsemestre_lists, - Permission.ScoView, -) sco_publish( "/formsemestre_status_menubar", sco_formsemestre_status.formsemestre_status_menubar, @@ -1178,12 +1173,6 @@ def formsemestre_custommenu_edit(context, REQUEST, formsemestre_id): ) -sco_publish( - "/formsemestre_custommenu_html", - sco_formsemestre_custommenu.formsemestre_custommenu_html, - Permission.ScoView, -) - # --- dialogue modif enseignants/moduleimpl @bp.route("/edit_enseignants_form") @permission_required(Permission.ScoView) @@ -2624,6 +2613,7 @@ def formsemestre_bulletins_mailetuds_choice( ) +# not published def formsemestre_bulletins_choice( context, REQUEST, formsemestre_id, title="", explanation="", choose_mail=False ): diff --git a/app/views/scolar.py b/app/views/scolar.py index 4e4ed8ae6..276a5312d 100644 --- a/app/views/scolar.py +++ b/app/views/scolar.py @@ -387,7 +387,7 @@ def etud_info(context, etudid=None, format="xml", REQUEST=None): ) d = {} etud = etuds[0] - context.fillEtudsInfo([etud]) + scolars.fillEtudsInfo(context, [etud]) etud["date_naissance_iso"] = ndb.DateDMYtoISO(etud["date_naissance"]) for a in ( "etudid", @@ -1460,7 +1460,7 @@ def _etudident_create_or_edit_form(context, REQUEST, edit): # modif d'un etudiant scolars.etudident_edit(cnx, tf[2], context=context, REQUEST=REQUEST) etud = scolars.etudident_list(cnx, {"etudid": etudid})[0] - context.fillEtudsInfo([etud]) + scolars.fillEtudsInfo(context, [etud]) # Inval semesters with this student: to_inval = [s["formsemestre_id"] for s in etud["sems"]] if to_inval: @@ -1482,7 +1482,7 @@ def etudident_delete(context, etudid, dialog_confirmed=False, REQUEST=None): raise ScoValueError("Etudiant inexistant !") else: etud = etuds[0] - context.fillEtudsInfo([etud]) + scolars.fillEtudsInfo(context, [etud]) if not dialog_confirmed: return scu.confirm_dialog( context, diff --git a/config.py b/config.py index 7a9cf90e6..1311f1e4d 100755 --- a/config.py +++ b/config.py @@ -35,6 +35,8 @@ class ConfigClass(object): SCODOC7_SQL_USER = os.environ.get("SCODOC7_SQL_USER", "www-data") DEFAULT_SQL_PORT = os.environ.get("DEFAULT_SQL_PORT", "5432") + SERVER_NAME = os.environ.get("SERVER_NAME") + def __init__(self): """Used to build some config variable at startup time""" self.SCODOC_VAR_DIR = os.path.join(self.INSTANCE_HOME, "var", "scodoc") diff --git a/scodoc.py b/scodoc.py index 471c96b9d..7d757ddd9 100755 --- a/scodoc.py +++ b/scodoc.py @@ -17,6 +17,7 @@ import flask from app import create_app, cli, db from app.auth.models import User, Role, UserRole +from app.views import notes, scolar, absences from config import Config @@ -32,6 +33,8 @@ def make_shell_context(): "User": User, "Role": Role, "UserRole": UserRole, + "notes": notes, + "scolar": scolar, "pp": pp, "flask": flask, "current_app": flask.current_app,