diff --git a/README.md b/README.md index 8e027adf4a..ebc1443b84 100644 --- a/README.md +++ b/README.md @@ -192,9 +192,13 @@ Charger les données ScoDoc 7: en tant qu'utilisateur "`scodoc`" (adaptez l'argument si les données ont été copiées ailleurs) -Note: le message -`pg_restore: warning: restoring tables WITH OIDS is not supported anymore` -est normal et anodin. +Note: les messages d'erreur comme + + pg_restore: warning: restoring tables WITH OIDS is not supported anymore + pg_restore: error: could not execute query: ERROR: schema "public" already exists + pg_restore: error: could not execute query: ERROR: must be owner of extension plpgsql + +sont normaux et a priori anodins. A ce stade, vous avez rechargé les bases ScoDoc 7 mais il faut encore les convertir vers la nouvelle structure ScoDoc 9. diff --git a/app/scodoc/html_sco_header.py b/app/scodoc/html_sco_header.py index 7381cc734e..056b0f24e7 100644 --- a/app/scodoc/html_sco_header.py +++ b/app/scodoc/html_sco_header.py @@ -339,7 +339,6 @@ def sco_footer(): def html_sem_header( - context, REQUEST, title, sem=None, diff --git a/app/scodoc/sco_archives.py b/app/scodoc/sco_archives.py index 15d186bfcb..5aea4c6bc4 100644 --- a/app/scodoc/sco_archives.py +++ b/app/scodoc/sco_archives.py @@ -90,7 +90,7 @@ class BaseArchiver(object): finally: scu.GSL.release() - def get_obj_dir(self, context, oid): + def get_obj_dir(self, oid): """ :return: path to directory of archives for this object (eg formsemestre_id or etudid). If directory does not yet exist, create it. @@ -117,11 +117,11 @@ class BaseArchiver(object): dirs = glob.glob(base + "*") return [os.path.split(x)[1] for x in dirs] - def list_obj_archives(self, context, oid): + def list_obj_archives(self, oid): """Returns :return: list of archive identifiers for this object (paths to non empty dirs) """ - base = self.get_obj_dir(context, oid) + os.path.sep + base = self.get_obj_dir(oid) + os.path.sep dirs = glob.glob( base + "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9]" @@ -164,11 +164,11 @@ class BaseArchiver(object): "^[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}$", archive_name ) - def get_id_from_name(self, context, oid, archive_name): + def get_id_from_name(self, oid, archive_name): """returns archive id (check that name is valid)""" if not self.is_valid_archive_name(archive_name): raise ValueError("invalid archive name") - archive_id = os.path.join(self.get_obj_dir(context, oid), archive_name) + archive_id = os.path.join(self.get_obj_dir(oid), archive_name) if not os.path.isdir(archive_id): log( "invalid archive name: %s, oid=%s, archive_id=%s" @@ -181,10 +181,10 @@ class BaseArchiver(object): """Return description of archive""" return open(os.path.join(archive_id, "_description.txt")).read() - def create_obj_archive(self, context, oid: int, description: str): + def create_obj_archive(self, oid: int, description: str): """Creates a new archive for this object and returns its id.""" archive_id = ( - self.get_obj_dir(context, oid) + self.get_obj_dir(oid) + os.path.sep + "-".join(["%02d" % x for x in time.localtime()[:6]]) ) @@ -223,10 +223,10 @@ class BaseArchiver(object): log("reading archive file %s" % fname) return open(fname, "rb").read() - def get_archived_file(self, context, REQUEST, oid, archive_name, filename): + def get_archived_file(self, REQUEST, oid, archive_name, filename): """Recupere donnees du fichier indiqué et envoie au client""" # XXX très incomplet: devrait inférer et assigner un type MIME - archive_id = self.get_id_from_name(context, oid, archive_name) + archive_id = self.get_id_from_name(oid, archive_name) data = self.get(archive_id, filename) ext = os.path.splitext(scu.strlower(filename))[1] if ext == ".html" or ext == ".htm": @@ -284,14 +284,14 @@ def do_formsemestre_archive( """ from app.scodoc.sco_recapcomplet import make_formsemestre_recapcomplet - archive_id = PVArchive.create_obj_archive(context, formsemestre_id, description) + archive_id = PVArchive.create_obj_archive(formsemestre_id, description) date = PVArchive.get_archive_date(archive_id).strftime("%d/%m/%Y à %H:%M") if not group_ids: # tous les inscrits du semestre group_ids = [sco_groups.get_default_group(formsemestre_id)] groups_infos = sco_groups_view.DisplayedGroupsInfos( - context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST + group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST ) groups_filename = "-" + groups_infos.groups_filename etudids = [m["etudid"] for m in groups_infos.members] @@ -386,12 +386,11 @@ def formsemestre_archive(context, REQUEST, formsemestre_id, group_ids=[]): # tous les inscrits du semestre group_ids = [sco_groups.get_default_group(formsemestre_id)] groups_infos = sco_groups_view.DisplayedGroupsInfos( - context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST + group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST ) H = [ html_sco_header.html_sem_header( - context, REQUEST, "Archiver les PV et résultats du semestre", sem=sem, @@ -420,7 +419,7 @@ enregistrés et non modifiables, on peut les retrouver ultérieurement. ), ("sep", {"input_type": "separator", "title": "Informations sur PV de jury"}), ] - descr += sco_pvjury.descrform_pvjury(context, sem) + descr += sco_pvjury.descrform_pvjury(sem) descr += [ ( "signature", @@ -447,7 +446,7 @@ enregistrés et non modifiables, on peut les retrouver ultérieurement. ] menu_choix_groupe = ( """
""" ) @@ -500,10 +499,10 @@ enregistrés et non modifiables, on peut les retrouver ultérieurement. ) -def formsemestre_list_archives(context, REQUEST, formsemestre_id): +def formsemestre_list_archives(REQUEST, formsemestre_id): """Page listing archives""" L = [] - for archive_id in PVArchive.list_obj_archives(context, formsemestre_id): + for archive_id in PVArchive.list_obj_archives(formsemestre_id): a = { "archive_id": archive_id, "description": PVArchive.get_archive_description(archive_id), @@ -513,11 +512,7 @@ def formsemestre_list_archives(context, REQUEST, formsemestre_id): L.append(a) sem = sco_formsemestre.get_formsemestre(formsemestre_id) - H = [ - html_sco_header.html_sem_header( - context, REQUEST, "Archive des PV et résultats ", sem - ) - ] + H = [html_sco_header.html_sem_header(REQUEST, "Archive des PV et résultats ", sem)] if not L: H.append("aucune archive enregistrée
") else: @@ -546,17 +541,13 @@ def formsemestre_list_archives(context, REQUEST, formsemestre_id): return "\n".join(H) + html_sco_header.sco_footer() -def formsemestre_get_archived_file( - context, REQUEST, formsemestre_id, archive_name, filename -): +def formsemestre_get_archived_file(REQUEST, formsemestre_id, archive_name, filename): """Send file to client.""" - return PVArchive.get_archived_file( - context, REQUEST, formsemestre_id, archive_name, filename - ) + return PVArchive.get_archived_file(REQUEST, formsemestre_id, archive_name, filename) def formsemestre_delete_archive( - context, REQUEST, formsemestre_id, archive_name, dialog_confirmed=False + REQUEST, formsemestre_id, archive_name, dialog_confirmed=False ): """Delete an archive""" if not sco_permissions_check.can_edit_pv(formsemestre_id): @@ -564,7 +555,7 @@ def formsemestre_delete_archive( "opération non autorisée pour %s" % str(REQUEST.AUTHENTICATED_USER) ) _ = sco_formsemestre.get_formsemestre(formsemestre_id) # check formsemestre_id - archive_id = PVArchive.get_id_from_name(context, formsemestre_id, archive_name) + archive_id = PVArchive.get_id_from_name(formsemestre_id, archive_name) dest_url = "formsemestre_list_archives?formsemestre_id=%s" % (formsemestre_id) diff --git a/app/scodoc/sco_archives_etud.py b/app/scodoc/sco_archives_etud.py index 78516d2044..231f3f8015 100644 --- a/app/scodoc/sco_archives_etud.py +++ b/app/scodoc/sco_archives_etud.py @@ -53,16 +53,16 @@ class EtudsArchiver(sco_archives.BaseArchiver): EtudsArchive = EtudsArchiver() -def can_edit_etud_archive(context, authuser): +def can_edit_etud_archive(authuser): """True si l'utilisateur peut modifier les archives etudiantes""" return authuser.has_permission(Permission.ScoEtudAddAnnotations) -def etud_list_archives_html(context, REQUEST, etudid): +def etud_list_archives_html(REQUEST, etudid): """HTML snippet listing archives""" - can_edit = can_edit_etud_archive(context, REQUEST.AUTHENTICATED_USER) + can_edit = can_edit_etud_archive(REQUEST.AUTHENTICATED_USER) L = [] - for archive_id in EtudsArchive.list_obj_archives(context, etudid): + for archive_id in EtudsArchive.list_obj_archives(etudid): a = { "archive_id": archive_id, "description": EtudsArchive.get_archive_description(archive_id), @@ -107,13 +107,13 @@ def etud_list_archives_html(context, REQUEST, etudid): return "".join(H) -def add_archives_info_to_etud_list(context, etuds): +def add_archives_info_to_etud_list(etuds): """Add key 'etudarchive' describing archive of etuds (used to list all archives of a group) """ for etud in etuds: l = [] - for archive_id in EtudsArchive.list_obj_archives(context, etud["etudid"]): + for archive_id in EtudsArchive.list_obj_archives(etud["etudid"]): l.append( "%s (%s)" % ( @@ -124,10 +124,10 @@ def add_archives_info_to_etud_list(context, etuds): etud["etudarchive"] = ", ".join(l) -def etud_upload_file_form(context, REQUEST, etudid): +def etud_upload_file_form(REQUEST, etudid): """Page with a form to choose and upload a file, with a description.""" # check permission - if not can_edit_etud_archive(context, REQUEST.AUTHENTICATED_USER): + if not can_edit_etud_archive(REQUEST.AUTHENTICATED_USER): raise AccessDenied( "opération non autorisée pour %s" % str(REQUEST.AUTHENTICATED_USER) ) @@ -172,34 +172,30 @@ def etud_upload_file_form(context, REQUEST, etudid): data = tf[2]["datafile"].read() descr = tf[2]["description"] filename = tf[2]["datafile"].filename - _store_etud_file_to_new_archive( - context, REQUEST, etudid, data, filename, description=descr - ) + _store_etud_file_to_new_archive(etudid, data, filename, description=descr) return flask.redirect( url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid) ) -def _store_etud_file_to_new_archive( - context, REQUEST, etudid, data, filename, description="" -): +def _store_etud_file_to_new_archive(etudid, data, filename, description=""): """Store data to new archive.""" filesize = len(data) if filesize < 10 or filesize > scu.CONFIG.ETUD_MAX_FILE_SIZE: return 0, "Fichier image de taille invalide ! (%d)" % filesize - archive_id = EtudsArchive.create_obj_archive(context, etudid, description) + archive_id = EtudsArchive.create_obj_archive(etudid, description) EtudsArchive.store(archive_id, filename, data) -def etud_delete_archive(context, REQUEST, etudid, archive_name, dialog_confirmed=False): +def etud_delete_archive(REQUEST, etudid, archive_name, dialog_confirmed=False): """Delete an archive""" # check permission - if not can_edit_etud_archive(context, REQUEST.AUTHENTICATED_USER): + if not can_edit_etud_archive(REQUEST.AUTHENTICATED_USER): raise AccessDenied( "opération non autorisée pour %s" % str(REQUEST.AUTHENTICATED_USER) ) etud = sco_etud.get_etud_info(filled=1, REQUEST=REQUEST)[0] - archive_id = EtudsArchive.get_id_from_name(context, etudid, archive_name) + archive_id = EtudsArchive.get_id_from_name(etudid, archive_name) if not dialog_confirmed: return scu.confirm_dialog( """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.
""", diff --git a/app/scodoc/sco_formsemestre_edit.py b/app/scodoc/sco_formsemestre_edit.py index 4172bf84e9..ab2d03e7a5 100644 --- a/app/scodoc/sco_formsemestre_edit.py +++ b/app/scodoc/sco_formsemestre_edit.py @@ -91,7 +91,6 @@ def formsemestre_editwithmodules(context, REQUEST, formsemestre_id): sem = sco_formsemestre.get_formsemestre(formsemestre_id) H = [ html_sco_header.html_sem_header( - context, REQUEST, "Modification du semestre", sem, @@ -329,7 +328,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): }, ), ] - etapes = sco_portal_apogee.get_etapes_apogee_dept(context) + etapes = sco_portal_apogee.get_etapes_apogee_dept() # Propose les etapes renvoyées par le portail # et ajoute les étapes du semestre qui ne sont pas dans la liste (soit la liste a changé, soit l'étape a été ajoutée manuellement) etapes_set = {et[0] for et in etapes} @@ -885,7 +884,6 @@ def formsemestre_clone(context, formsemestre_id, REQUEST=None): H = [ html_sco_header.html_sem_header( - context, REQUEST, "Copie du semestre", sem, @@ -1238,9 +1236,7 @@ def formsemestre_delete(context, formsemestre_id, REQUEST=None): sem = sco_formsemestre.get_formsemestre(formsemestre_id) F = sco_formations.formation_list(args={"formation_id": sem["formation_id"]})[0] H = [ - html_sco_header.html_sem_header( - context, REQUEST, "Suppression du semestre", sem - ), + html_sco_header.html_sem_header(REQUEST, "Suppression du semestre", sem), """A n'utiliser qu'en cas d'erreur lors de la saisie d'une formation. Normalement, un semestre ne doit jamais être supprimé (on perd la mémoire des notes et de tous les événements liés à ce semestre !).
@@ -1548,7 +1544,7 @@ def formsemestre_edit_uecoefs(context, formsemestre_id, err_ue_id=None, REQUEST= """ H = [ html_sco_header.html_sem_header( - context, REQUEST, "Coefficients des UE du semestre", sem + REQUEST, "Coefficients des UE du semestre", sem ), help, ] @@ -1662,7 +1658,7 @@ def formsemestre_edit_uecoefs(context, formsemestre_id, err_ue_id=None, REQUEST= ) # > modif coef UE cap (modifs notes de _certains_ etudiants) header = html_sco_header.html_sem_header( - context, REQUEST, "Coefficients des UE du semestre", sem + REQUEST, "Coefficients des UE du semestre", sem ) return ( header diff --git a/app/scodoc/sco_formsemestre_inscriptions.py b/app/scodoc/sco_formsemestre_inscriptions.py index ed4651c8d1..62dcfd47ed 100644 --- a/app/scodoc/sco_formsemestre_inscriptions.py +++ b/app/scodoc/sco_formsemestre_inscriptions.py @@ -336,7 +336,6 @@ def formsemestre_inscription_with_modules( etud = sco_etud.get_etud_info(etudid=etudid, filled=1)[0] H = [ html_sco_header.html_sem_header( - context, REQUEST, "Inscription de %s dans ce semestre" % etud["nomprenom"], sem, @@ -762,7 +761,6 @@ def formsemestre_inscrits_ailleurs(context, formsemestre_id, REQUEST=None): sem = sco_formsemestre.get_formsemestre(formsemestre_id) H = [ html_sco_header.html_sem_header( - context, REQUEST, "Inscriptions multiples parmi les étudiants du semestre ", sem, diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index 63e3d676f4..694532461a 100644 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -376,9 +376,7 @@ def formsemestre_status_menubar(context, sem): "title": "Envoyer à chaque étudiant son bulletin par e-mail", "endpoint": "notes.formsemestre_bulletins_mailetuds_choice", "args": {"formsemestre_id": formsemestre_id}, - "enabled": sco_bulletins.can_send_bulletin_by_mail( - context, formsemestre_id - ), + "enabled": sco_bulletins.can_send_bulletin_by_mail(formsemestre_id), }, { "title": "Calendrier des évaluations", @@ -424,9 +422,7 @@ def formsemestre_status_menubar(context, sem): "title": "Documents archivés", "endpoint": "notes.formsemestre_list_archives", "args": {"formsemestre_id": formsemestre_id}, - "enabled": sco_archives.PVArchive.list_obj_archives( - context, formsemestre_id - ), + "enabled": sco_archives.PVArchive.list_obj_archives(formsemestre_id), }, ] @@ -713,7 +709,7 @@ def formsemestre_description_table( % (REQUEST.URL0, formsemestre_id, with_evals), page_title=title, html_title=html_sco_header.html_sem_header( - context, REQUEST, "Description du semestre", sem, with_page_header=False + REQUEST, "Description du semestre", sem, with_page_header=False ), pdf_title=title, preferences=sco_preferences.SemPreferences(formsemestre_id), @@ -927,7 +923,7 @@ def formsemestre_status_head( H = [ html_sco_header.html_sem_header( - context, REQUEST, page_title, sem, with_page_header=False, with_h2=False + REQUEST, page_title, sem, with_page_header=False, with_h2=False ), """Formation: |
diff --git a/app/scodoc/sco_formsemestre_validation.py b/app/scodoc/sco_formsemestre_validation.py
index 8dd2a5dad6..5a17f91a74 100644
--- a/app/scodoc/sco_formsemestre_validation.py
+++ b/app/scodoc/sco_formsemestre_validation.py
@@ -830,7 +830,7 @@ def formsemestre_validation_auto(context, formsemestre_id, REQUEST):
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
H = [
html_sco_header.html_sem_header(
- context, REQUEST, "Saisie automatique des décisions du semestre", sem
+ REQUEST, "Saisie automatique des décisions du semestre", sem
),
"""
|