From 069f99616821c44e927c4e8183601db5d2b914af Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 13 Jul 2021 14:53:14 +0200 Subject: [PATCH] misc fixes --- app/scodoc/sco_find_etud.py | 5 +- app/scodoc/sco_groups.py | 6 +-- app/views/scolar.py | 93 ++++++++++++++++++++++++++++++------- 3 files changed, 81 insertions(+), 23 deletions(-) diff --git a/app/scodoc/sco_find_etud.py b/app/scodoc/sco_find_etud.py index 5892f9bb..539c861a 100644 --- a/app/scodoc/sco_find_etud.py +++ b/app/scodoc/sco_find_etud.py @@ -54,13 +54,12 @@ def form_search_etud( if title: H.append("

%s

" % title) H.append( - """
- %s + f""" + {title}
(entrer une partie du nom) """ - % title ) if dest_url: H.append('' % dest_url) diff --git a/app/scodoc/sco_groups.py b/app/scodoc/sco_groups.py index b643117c..9dcb7d9d 100644 --- a/app/scodoc/sco_groups.py +++ b/app/scodoc/sco_groups.py @@ -687,9 +687,9 @@ def setGroups( if not group_name: continue # ajax arguments are encoded in utf-8: - group_name = six.text_type(group_name, "utf-8").encode( - scu.SCO_ENCODING - ) # #py3 #sco8 + # group_name = six.text_type(group_name, "utf-8").encode( + # scu.SCO_ENCODING + # ) # #py3 #sco8 group_id = createGroup(context, partition_id, group_name, REQUEST=REQUEST) # Place dans ce groupe les etudiants indiqués: for etudid in fs[1:-1]: diff --git a/app/views/scolar.py b/app/views/scolar.py index af5502e0..8600badf 100644 --- a/app/views/scolar.py +++ b/app/views/scolar.py @@ -327,7 +327,10 @@ def getEtudInfo( sco_publish( - "/search_etud_in_dept", sco_find_etud.search_etud_in_dept, Permission.ScoView + "/search_etud_in_dept", + sco_find_etud.search_etud_in_dept, + Permission.ScoView, + methods=["GET", "POST"], ) sco_publish( @@ -444,7 +447,10 @@ sco_publish( ) sco_publish( - "/etud_delete_archive", sco_archives_etud.etud_delete_archive, Permission.ScoView + "/etud_delete_archive", + sco_archives_etud.etud_delete_archive, + Permission.ScoView, + methods=["GET", "POST"], ) sco_publish( @@ -494,7 +500,7 @@ sco_publish( ) -@bp.route("/doAddAnnotation") +@bp.route("/doAddAnnotation", methods=["GET", "POST"]) @permission_required(Permission.ScoEtudAddAnnotations) @scodoc7func(context) def doAddAnnotation(context, etudid, comment, REQUEST): @@ -516,7 +522,7 @@ def doAddAnnotation(context, etudid, comment, REQUEST): ) -@bp.route("/doSuppressAnnotation") +@bp.route("/doSuppressAnnotation", methods=["GET", "POST"]) @permission_required(Permission.ScoView) @scodoc7func(context) def doSuppressAnnotation(context, etudid, annotation_id, REQUEST): @@ -616,7 +622,12 @@ def formChangeCoordonnees(context, etudid, REQUEST): # --- Gestion des groupes: -sco_publish("/affectGroups", sco_groups_edit.affectGroups, Permission.ScoView) +sco_publish( + "/affectGroups", + sco_groups_edit.affectGroups, + Permission.ScoView, + methods=["GET", "POST"], +) sco_publish( "/XMLgetGroupsInPartition", sco_groups.XMLgetGroupsInPartition, Permission.ScoView @@ -634,27 +645,75 @@ sco_publish("/createGroup", sco_groups.createGroup, Permission.ScoView) sco_publish("/suppressGroup", sco_groups.suppressGroup, Permission.ScoView) -sco_publish("/group_set_name", sco_groups.group_set_name, Permission.ScoView) - -sco_publish("/group_rename", sco_groups.group_rename, Permission.ScoView) - sco_publish( - "/groups_auto_repartition", sco_groups.groups_auto_repartition, Permission.ScoView + "/group_set_name", + sco_groups.group_set_name, + Permission.ScoView, + methods=["GET", "POST"], ) -sco_publish("/editPartitionForm", sco_groups.editPartitionForm, Permission.ScoView) +sco_publish( + "/group_rename", + sco_groups.group_rename, + Permission.ScoView, + methods=["GET", "POST"], +) -sco_publish("/partition_delete", sco_groups.partition_delete, Permission.ScoView) +sco_publish( + "/groups_auto_repartition", + sco_groups.groups_auto_repartition, + Permission.ScoView, + methods=["GET", "POST"], +) -sco_publish("/partition_set_attr", sco_groups.partition_set_attr, Permission.ScoView) +sco_publish( + "/editPartitionForm", + sco_groups.editPartitionForm, + Permission.ScoView, + methods=["GET", "POST"], +) -sco_publish("/partition_move", sco_groups.partition_move, Permission.ScoView) +sco_publish( + "/partition_delete", + sco_groups.partition_delete, + Permission.ScoView, + methods=["GET", "POST"], +) -sco_publish("/partition_set_name", sco_groups.partition_set_name, Permission.ScoView) +sco_publish( + "/partition_set_attr", + sco_groups.partition_set_attr, + Permission.ScoView, + methods=["GET", "POST"], +) -sco_publish("/partition_rename", sco_groups.partition_rename, Permission.ScoView) +sco_publish( + "/partition_move", + sco_groups.partition_move, + Permission.ScoView, + methods=["GET", "POST"], +) -sco_publish("/partition_create", sco_groups.partition_create, Permission.ScoView) +sco_publish( + "/partition_set_name", + sco_groups.partition_set_name, + Permission.ScoView, + methods=["GET", "POST"], +) + +sco_publish( + "/partition_rename", + sco_groups.partition_rename, + Permission.ScoView, + methods=["GET", "POST"], +) + +sco_publish( + "/partition_create", + sco_groups.partition_create, + Permission.ScoView, + methods=["GET", "POST"], +) sco_publish("/etud_info_html", sco_page_etud.etud_info_html, Permission.ScoView)