From 2835777ea609a58719cdd34fb8e940f1fc8d02d9 Mon Sep 17 00:00:00 2001 From: IDK Date: Thu, 4 Feb 2021 20:02:44 +0100 Subject: [PATCH] Changed sco_utils import --- ImportScolars.py | 23 +++++----- html_sco_header.py | 10 +++-- html_sidebar.py | 6 +-- notes_table.py | 36 ++++++++------- pe_tools.py | 8 ++-- pe_view.py | 6 +-- sco_abs_notification.py | 7 +-- sco_apogee_compare.py | 2 +- sco_archives.py | 45 ++++++++++--------- sco_archives_etud.py | 11 ++--- sco_cost_formation.py | 5 ++- sco_dept.py | 12 ++--- sco_dump_db.py | 33 +++++++------- sco_edit_formation.py | 4 +- sco_edit_matiere.py | 6 +-- sco_edit_module.py | 14 +++--- sco_edit_ue.py | 22 ++++----- sco_edt_cal.py | 5 ++- sco_etape_apogee.py | 6 ++- sco_etape_apogee_view.py | 12 ++--- sco_excel.py | 81 ++++++++++++++++++++-------------- sco_export_results.py | 14 +++--- sco_find_etud.py | 21 +++++---- sco_formations.py | 15 ++++--- sco_formsemestre.py | 13 +++--- sco_formsemestre_custommenu.py | 2 +- sco_formsemestre_edit.py | 16 +++---- sco_formsemestre_validation.py | 19 ++++---- sco_formulas.py | 2 +- sco_groups.py | 27 ++++++------ sco_groups_edit.py | 2 +- sco_import_users.py | 14 +++--- sco_inscr_passage.py | 16 ++----- sco_liste_notes.py | 39 +++++++--------- sco_lycee.py | 8 ++-- sco_moduleimpl_inscriptions.py | 6 +-- sco_page_etud.py | 11 ++--- sco_placement.py | 31 ++++++++----- sco_poursuite_dut.py | 16 +++---- sco_preferences.py | 21 ++++----- sco_prepajury.py | 12 ++--- sco_pvjury.py | 20 +++++---- sco_pvpdf.py | 10 ++--- sco_recapcomplet.py | 53 +++++++++++++--------- sco_semset.py | 6 +-- sco_tag_module.py | 6 +-- sco_trombino.py | 13 +++--- sco_trombino_tours.py | 6 +-- sco_ue_external.py | 5 ++- sco_undo_notes.py | 11 ++--- sco_up_to_date.py | 11 +++-- 51 files changed, 430 insertions(+), 370 deletions(-) diff --git a/ImportScolars.py b/ImportScolars.py index 8a417632b..4502abd33 100644 --- a/ImportScolars.py +++ b/ImportScolars.py @@ -34,8 +34,9 @@ import time import pdb import collections import types +import re -from sco_utils import * +import sco_utils as scu import notesdb as ndb from notes_log import log import scolars @@ -107,7 +108,7 @@ ADMISSION_MODIFIABLE_FIELDS = ( def sco_import_format(with_codesemestre=True): "returns tuples (Attribut, Type, Table, AllowNulls, Description)" r = [] - for l in open(SCO_SRCDIR + "/" + FORMAT_FILE): + for l in open(scu.SCO_SRCDIR + "/" + FORMAT_FILE): l = l.strip() if l and l[0] != "#": fs = l.split(";") @@ -166,10 +167,10 @@ def sco_import_generate_excel_sample( titles = [] titlesStyles = [] for l in fmt: - name = strlower(l[0]) + name = scu.strlower(l[0]) if (not with_codesemestre) and name == "codesemestre": continue # pas de colonne codesemestre - if only_tables is not None and strlower(l[2]) not in only_tables: + if only_tables is not None and scu.strlower(l[2]) not in only_tables: continue # table non demandée if name in exclude_cols: continue # colonne exclue @@ -206,7 +207,7 @@ def sco_import_generate_excel_sample( ) l.append(etud["partitionsgroupes"]) else: - key = strlower(field).split()[0] + key = scu.strlower(field).split()[0] l.append(etud.get(key, "")) lines.append(l) else: @@ -279,7 +280,7 @@ def scolars_import_excel_file( titles = {} fmt = sco_import_format() for l in fmt: - tit = strlower(l[0]).split()[0] # titles in lowercase, and take 1st word + tit = scu.strlower(l[0]).split()[0] # titles in lowercase, and take 1st word if ( (not formsemestre_id) or (tit != "codesemestre") ) and tit not in exclude_cols: @@ -288,7 +289,7 @@ def scolars_import_excel_file( # log("titles=%s" % titles) # remove quotes, downcase and keep only 1st word try: - fs = [strlower(stripquotes(s)).split()[0] for s in data[0]] + fs = [scu.strlower(scu.stripquotes(s)).split()[0] for s in data[0]] except: raise ScoValueError("Titres de colonnes invalides (ou vides ?)") # log("excel: fs='%s'\ndata=%s" % (str(fs), str(data))) @@ -365,7 +366,7 @@ def scolars_import_excel_file( % (val, linenum, titleslist[i]) ) # xxx Ad-hoc checks (should be in format description) - if strlower(titleslist[i]) == "sexe": + if scu.strlower(titleslist[i]) == "sexe": try: val = scolars.normalize_sexe(val) except: @@ -374,13 +375,13 @@ def scolars_import_excel_file( % (val, linenum, titleslist[i]) ) # Excel date conversion: - if strlower(titleslist[i]) == "date_naissance": + if scu.strlower(titleslist[i]) == "date_naissance": if val: if re.match("^[0-9]*\.?[0-9]*$", str(val)): val = sco_excel.xldate_as_datetime(float(val)) # INE if ( - strlower(titleslist[i]) == "code_ine" + scu.strlower(titleslist[i]) == "code_ine" and always_require_ine and not val ): @@ -703,7 +704,7 @@ _ADM_PATTERN = re.compile(r"[\W]+", re.UNICODE) # supprime tout sauf alphanum def adm_normalize_string(s): # normalize unicode title - return suppression_diacritics(_ADM_PATTERN.sub("", s.strip().lower())).replace( + return scu.suppression_diacritics(_ADM_PATTERN.sub("", s.strip().lower())).replace( "_", "" ) diff --git a/html_sco_header.py b/html_sco_header.py index d66a875b3..89003b667 100644 --- a/html_sco_header.py +++ b/html_sco_header.py @@ -27,7 +27,7 @@ import cgi -from sco_utils import * +import sco_utils as scu from sco_formsemestre_status import formsemestre_page_title """ @@ -97,7 +97,7 @@ def sco_header( "page_title": page_title or context.title_or_id(), "no_side_bar": no_side_bar, "ScoURL": context.ScoURL(), - "encoding": SCO_ENCODING, + "encoding": scu.SCO_ENCODING, "titrebandeau_mkup": "" + titrebandeau + "", "authuser": str(REQUEST.AUTHENTICATED_USER), } @@ -226,7 +226,7 @@ def sco_header( # Body et bandeau haut: H.append("""""" % params) - H.append(CUSTOM_HTML_HEADER) + H.append(scu.CUSTOM_HTML_HEADER) # if not no_side_bar: H.append(context.sidebar(REQUEST)) @@ -260,4 +260,6 @@ def sco_header( def sco_footer(context, REQUEST=None): """Main HTMl pages footer""" - return """""" + CUSTOM_HTML_FOOTER + """""" + return ( + """""" + scu.CUSTOM_HTML_FOOTER + """""" + ) diff --git a/html_sidebar.py b/html_sidebar.py index 1c11cf57a..7c50d5c3b 100644 --- a/html_sidebar.py +++ b/html_sidebar.py @@ -25,7 +25,7 @@ # ############################################################################## -from sco_utils import * +import sco_utils as scu from sco_abs import getAbsSemEtud from sco_permissions import ( ScoUsersAdmin, @@ -82,7 +82,7 @@ def sidebar_common(context, REQUEST=None): def sidebar(context, REQUEST=None): "Main HTML page sidebar" # rewritten from legacy DTML code - params = {"ScoURL": context.ScoURL(), "SCO_USER_MANUAL": SCO_USER_MANUAL} + params = {"ScoURL": context.ScoURL(), "SCO_USER_MANUAL": scu.SCO_USER_MANUAL} H = ['
 ") # /etud-insidebar # Logo - scologo_img = icontag("scologo_img") + scologo_img = scu.icontag("scologo_img") H.append('