diff --git a/README.md b/README.md index 73488544c..48336d5d2 100644 --- a/README.md +++ b/README.md @@ -55,20 +55,9 @@ Installer le bon vieux `pyExcelerator` dans l'environnement: ## Migration ZScolar ### Méthodes qui ne devraient plus être publiées: -security.declareProtected(ScoView, "get_preferences") - -def get_preferences(context, formsemestre_id=None): - "Get preferences for this instance (a dict-like instance)" - return sco_preferences.sem_preferences(context, formsemestre_id) - -security.declareProtected(ScoView, "get_preference") - -def get_preference(context, name, formsemestre_id=None): - """Returns value of named preference. - All preferences have a sensible default value (see sco_preferences.py), - this function always returns a usable value for all defined preferences names. - """ - return sco_preferences.get_base_preferences(context).get(formsemestre_id, name) + + + diff --git a/app/scodoc/ImportScolars.py b/app/scodoc/ImportScolars.py index 1935701f1..701ede72c 100644 --- a/app/scodoc/ImportScolars.py +++ b/app/scodoc/ImportScolars.py @@ -240,7 +240,9 @@ def students_import_excel( dest = "formsemestre_status?formsemestre_id=%s" % formsemestre_id else: dest = context.NotesURL() - H = [html_sco_header.sco_header(context, REQUEST, page_title="Import etudiants")] + H = [ + html_sco_header.sco_header(context, REQUEST, page_title="Import etudiants") + ] H.append("
Cette fonction génère un ensemble de fichiers permettant d'éditer des avis de poursuites d'études. @@ -95,7 +97,7 @@ def pe_view_sem_recap( """ if REQUEST and REQUEST.method == "GET": return _pe_view_sem_recap_form(context, formsemestre_id, REQUEST=REQUEST) - prefs = context.get_preferences(formsemestre_id=formsemestre_id) + prefs = sco_preferences.SemPreferences(context, formsemestre_id=formsemestre_id) semBase = sco_formsemestre.get_formsemestre(context, formsemestre_id) diff --git a/app/scodoc/sco_abs.py b/app/scodoc/sco_abs.py index 21538e677..415101eab 100644 --- a/app/scodoc/sco_abs.py +++ b/app/scodoc/sco_abs.py @@ -45,7 +45,7 @@ import sco_compute_moy def is_work_saturday(context): "Vrai si le samedi est travaillé" - return int(context.get_preference("work_saturday")) + return int(sco_preferences.get_preference(context, "work_saturday")) def MonthNbDays(month, year): diff --git a/app/scodoc/sco_abs_notification.py b/app/scodoc/sco_abs_notification.py index a163dc974..5433d0bb6 100644 --- a/app/scodoc/sco_abs_notification.py +++ b/app/scodoc/sco_abs_notification.py @@ -71,7 +71,9 @@ def do_abs_notify(context, sem, etudid, date, nbabs, nbabsjust): formsemestre_id = sem["formsemestre_id"] else: formsemestre_id = None - prefs = context.get_preferences(formsemestre_id=sem["formsemestre_id"]) + prefs = sco_preferences.SemPreferences( + context, formsemestre_id=sem["formsemestre_id"] + ) destinations = abs_notify_get_destinations( context, sem, prefs, etudid, date, nbabs, nbabsjust @@ -81,7 +83,7 @@ def do_abs_notify(context, sem, etudid, date, nbabs, nbabsjust): return # abort # Vérification fréquence (pour ne pas envoyer de mails trop souvent) - abs_notify_max_freq = context.get_preference("abs_notify_max_freq") + abs_notify_max_freq = sco_preferences.get_preference(context, "abs_notify_max_freq") destinations_filtered = [] for email_addr in destinations: nbdays_since_last_notif = user_nbdays_since_last_notif( @@ -179,10 +181,10 @@ def abs_notify_is_above_threshold(context, etudid, nbabs, nbabsjust, formsemestr (nbabs > abs_notify_abs_threshold) (nbabs - nbabs_last_notified) > abs_notify_abs_increment """ - abs_notify_abs_threshold = context.get_preference( + abs_notify_abs_threshold = sco_preferences.get_preference(context, "abs_notify_abs_threshold", formsemestre_id ) - abs_notify_abs_increment = context.get_preference( + abs_notify_abs_increment = sco_preferences.get_preference(context, "abs_notify_abs_increment", formsemestre_id ) nbabs_last_notified = etud_nbabs_last_notified(context, etudid, formsemestre_id) diff --git a/app/scodoc/sco_abs_views.py b/app/scodoc/sco_abs_views.py index 95b1677d9..cc38fc80b 100644 --- a/app/scodoc/sco_abs_views.py +++ b/app/scodoc/sco_abs_views.py @@ -116,8 +116,10 @@ def doSignaleAbsence( if modimpl["moduleimpl_id"] == moduleimpl_id: M = "dans le module %s" % modimpl["module"]["code"] H = [ - html_sco_header.sco_header(context, - REQUEST, page_title="Signalement d'une absence pour %(nomprenom)s" % etud + html_sco_header.sco_header( + context, + REQUEST, + page_title="Signalement d'une absence pour %(nomprenom)s" % etud, ), """
Signalement d'une absence pour %(nomprenom)s@@ -316,8 +320,10 @@ def doJustifAbsence( nbadded += 1 # H = [ - html_sco_header.sco_header(context, - REQUEST, page_title="Justification d'une absence pour %(nomprenom)s" % etud + html_sco_header.sco_header( + context, + REQUEST, + page_title="Justification d'une absence pour %(nomprenom)s" % etud, ), """Justification d'absences""", ] @@ -352,8 +358,10 @@ def JustifAbsenceEtud(context, REQUEST=None): # etudid implied etud = context.getEtudInfo(filled=1, REQUEST=REQUEST)[0] etudid = etud["etudid"] H = [ - html_sco_header.sco_header(context, - REQUEST, page_title="Justification d'une absence pour %(nomprenom)s" % etud + html_sco_header.sco_header( + context, + REQUEST, + page_title="Justification d'une absence pour %(nomprenom)s" % etud, ), """
|