From 154e7bf3e8a80822a6d8ab970165c4b160383189 Mon Sep 17 00:00:00 2001 From: IDK Date: Sun, 7 Feb 2021 09:10:26 +0100 Subject: [PATCH] Replaced Zope URL1 and URL2 --- ImportScolars.py | 2 +- ZAbsences.py | 6 +-- ZEntreprises.py | 46 ++++++++++---------- ZNotes.py | 10 +++-- ZScoDoc.py | 5 +-- ZScoUsers.py | 21 +++++---- ZScolar.py | 78 ++++++++++++++++++++++++++-------- debug.py | 1 - sco_archives_etud.py | 8 +++- sco_edit_formation.py | 8 ++-- sco_edit_matiere.py | 12 +++--- sco_edit_module.py | 6 +-- sco_edit_ue.py | 2 +- sco_formsemestre_custommenu.py | 9 ++-- sco_formsemestre_edit.py | 28 ++++++------ sco_groups.py | 7 +-- sco_placement.py | 4 +- sco_preferences.py | 18 ++++---- 18 files changed, 160 insertions(+), 111 deletions(-) diff --git a/ImportScolars.py b/ImportScolars.py index 4502abd3..8e06e93c 100644 --- a/ImportScolars.py +++ b/ImportScolars.py @@ -239,7 +239,7 @@ def students_import_excel( if formsemestre_id: dest = "formsemestre_status?formsemestre_id=%s" % formsemestre_id else: - dest = REQUEST.URL1 + dest = context.NotesURL() H = [context.sco_header(REQUEST, page_title="Import etudiants")] H.append("") return "\n".join(H) + entreprise_footer(self, REQUEST) elif tf[0] == -1: - return REQUEST.RESPONSE.redirect(REQUEST.URL1 + "?start=" + start) + return REQUEST.RESPONSE.redirect(self.EntreprisesURL() + "?start=" + start) else: sco_entreprises.do_entreprise_edit(self, tf[2]) - return REQUEST.RESPONSE.redirect(REQUEST.URL1 + "?start=" + start) + return REQUEST.RESPONSE.redirect(self.EntreprisesURL() + "?start=" + start) diff --git a/ZNotes.py b/ZNotes.py index bc8b54d6..553f3538 100644 --- a/ZNotes.py +++ b/ZNotes.py @@ -257,10 +257,12 @@ class ZNotes(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Impl sco_formsemestre_edit.formsemestre_createwithmodules ) - security.declareProtected(ScoView, "formsemestre_editwithmodules") + security.declareProtected( + ScoView, "formsemestre_editwithmodules" + ) # controle d'acces specifique pour dir. etud formsemestre_editwithmodules = sco_formsemestre_edit.formsemestre_editwithmodules - security.declareProtected(ScoView, "formsemestre_clone") + security.declareProtected(ScoImplement, "formsemestre_clone") formsemestre_clone = sco_formsemestre_edit.formsemestre_clone security.declareProtected(ScoChangeFormation, "formsemestre_associate_new_version") @@ -521,7 +523,7 @@ class ZNotes(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Impl if tf[0] == 0: return "\n".join(H) + tf[1] + footer elif tf[0] == -1: - return REQUEST.RESPONSE.redirect(REQUEST.URL1) + return REQUEST.RESPONSE.redirect(self.NotesURL()) else: formation_id, _, _ = self.formation_import_xml(tf[2]["xmlfile"], REQUEST) @@ -675,7 +677,7 @@ class ZNotes(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Impl # if not force: return REQUEST.RESPONSE.redirect( - REQUEST.URL1 + "/ue_list?formation_id=" + str(ue["formation_id"]) + self.NotesURL() + "/ue_list?formation_id=" + str(ue["formation_id"]) ) else: return None diff --git a/ZScoDoc.py b/ZScoDoc.py index 56204368..3de841af 100644 --- a/ZScoDoc.py +++ b/ZScoDoc.py @@ -335,8 +335,7 @@ class ZScoDoc(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp return ( "

Département " + DeptId - + """ supprimé du serveur web (la base de données n'est pas affectée)!

Continuer

""" - % REQUEST.URL1 + + """ supprimé du serveur web (la base de données n'est pas affectée)!

Continuer

""" ) _top_level_css = """ @@ -973,5 +972,5 @@ def manage_addZScoDoc(self, id="ScoDoc", title="Site ScoDoc", REQUEST=None): ) # ne cree (presque rien), tout se passe lors du 1er accès self._setObject(id, zscodoc) if REQUEST is not None: - REQUEST.RESPONSE.redirect("%s/manage_workspace" % REQUEST.URL1) + REQUEST.RESPONSE.redirect("/ScoDoc/manage_workspace") return id diff --git a/ZScoUsers.py b/ZScoUsers.py index 64355f43..2550bb4f 100644 --- a/ZScoUsers.py +++ b/ZScoUsers.py @@ -792,11 +792,12 @@ class ZScoUsers( descr, initvalues=initvalues, submitlabel=submitlabel, + cancelbutton="Annuler", ) if tf[0] == 0: return "\n".join(H) + "\n" + tf[1] + F elif tf[0] == -1: - return REQUEST.RESPONSE.redirect(REQUEST.URL1) + return REQUEST.RESPONSE.redirect(self.UsersURL()) else: vals = tf[2] roles = set(vals["roles"]).intersection(editable_roles) @@ -997,7 +998,7 @@ class ZScoUsers( if tf[0] == 0: return "\n".join(H) + tf[1] + "" + help + F elif tf[0] == -1: - return REQUEST.RESPONSE.redirect(REQUEST.URL1) + return REQUEST.RESPONSE.redirect(self.UsersURL()) else: # IMPORT diag = sco_import_users.import_excel_file( @@ -1006,7 +1007,9 @@ class ZScoUsers( H = [head] H.append("

Import excel: %s

" % diag) H.append("

OK, import terminé !

") - H.append('

Continuer

' % REQUEST.URL1) + H.append( + '

Continuer

' % self.UsersURL() + ) return "\n".join(H) + help + F security.declareProtected(ScoUsersAdmin, "import_users_generate_excel_sample") @@ -1037,7 +1040,7 @@ class ZScoUsers( ) if REQUEST: - return REQUEST.RESPONSE.redirect(REQUEST.URL1) + return REQUEST.RESPONSE.redirect(self.UsersURL()) security.declareProtected(ScoUsersAdmin, "delete_user_form") @@ -1065,11 +1068,13 @@ class ZScoUsers( % user_name, dest_url="", REQUEST=REQUEST, - cancel_url=REQUEST.URL1, + cancel_url=self.UsersURL(), parameters={"user_name": user_name}, ) self._user_delete(user_name) - REQUEST.RESPONSE.redirect(REQUEST.URL1) + REQUEST.RESPONSE.redirect( + self.UsersURL() + r"?head_message=Utilisateur%20supprimé" + ) security.declareProtected(ScoView, "list_users") @@ -1260,8 +1265,8 @@ Il devra ensuite se connecter et le changer. ) self.reset_password(user_name=user_name, REQUEST=REQUEST) return REQUEST.RESPONSE.redirect( - REQUEST.URL1 - + "?head_message=mot%20de%20passe%20de%20" + self.UsersURL() + + r"?head_message=mot%20de%20passe%20de%20" + user_name + "%20reinitialise" ) diff --git a/ZScolar.py b/ZScolar.py index 314b9bb2..0537b67e 100644 --- a/ZScolar.py +++ b/ZScolar.py @@ -294,11 +294,16 @@ class ZScolar(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp

-UE11 Découverte métiers (code UCOD46, 16 ECTS, Apo VRTU11) -[verrouillé] + +REQUEST.URL=%s
+REQUEST.URL0=%s
+

- """ + """ % ( + REQUEST.URL, + REQUEST.URL0, + ) # return ( # self.sco_header(REQUEST) # + """
%s
""" % x @@ -315,7 +320,7 @@ UE11 Découverte métiers (code UCOD46, 16 ECTS, Apo (code UCOD46, 16 ECTS, Apo (code UCOD46, 16 ECTS, Apo (code UCOD46, 16 ECTS, Apo (code UCOD46, 16 ECTS, Apo Erreur:' + diag + "

") return "\n".join(H) + self.sco_footer(REQUEST) @@ -1350,7 +1381,7 @@ UE11 Découverte métiers (code UCOD46, 16 ECTS, Apo (code UCOD46, 16 ECTS, Apo - return REQUEST.RESPONSE.redirect(REQUEST.URL1) + return REQUEST.RESPONSE.redirect( + self.ScoURL() + r"?head_message=Etudiant%20supprimé" + ) security.declareProtected(ScoEtudInscrit, "check_group_apogee") @@ -2210,8 +2243,13 @@ UE11 Découverte métiers (code UCOD46, 16 ECTS, Apo " + "\n".join(S) + F elif tf[0] == -1: - return REQUEST.RESPONSE.redirect(REQUEST.URL1) + return REQUEST.RESPONSE.redirect(dest_url) else: return ImportScolars.students_import_excel( self, @@ -2464,7 +2502,11 @@ Les champs avec un astérisque (*) doivent être présents (nulls non autorisés if tf[0] == 0: return "\n".join(H) + tf[1] + help_text + F elif tf[0] == -1: - return REQUEST.RESPONSE.redirect(REQUEST.URL1) + return REQUEST.RESPONSE.redirect( + self.ScoURL() + + "/formsemestre_status?formsemestre_id=" + + formsemestre_id + ) else: return self._students_import_admission( tf[2]["csvfile"], @@ -2673,7 +2715,7 @@ def manage_addZScolarForm(context, DeptId, REQUEST=None): if tf[0] == 0: return "\n".join(H) + tf[1] + context.standard_html_footer(context) elif tf[0] == -1: - return REQUEST.RESPONSE.redirect(REQUEST.URL1) + return REQUEST.RESPONSE.redirect("/ScoDoc") else: DeptId = tf[2]["DeptId"].strip() db_cnx_string = tf[2]["db_cnx_string"].strip() diff --git a/debug.py b/debug.py index d0b8a4dd..52a31f7a 100644 --- a/debug.py +++ b/debug.py @@ -109,7 +109,6 @@ class DummyRequest: self.AUTHENTICATED_USER = FakeUser("admin") self.form = {} self.URL = "http://scodoc/" - self.URL1 = self.URL self.URL0 = self.URL self.BASE0 = "localhost" self.REMOTE_HOST = "localhost" diff --git a/sco_archives_etud.py b/sco_archives_etud.py index 25abb068..0d69bfe6 100644 --- a/sco_archives_etud.py +++ b/sco_archives_etud.py @@ -164,7 +164,9 @@ def etud_upload_file_form(context, REQUEST, etudid): if tf[0] == 0: return "\n".join(H) + tf[1] + context.sco_footer(REQUEST) elif tf[0] == -1: - return REQUEST.RESPONSE.redirect(REQUEST.URL1 + "/ficheEtud?etudid=" + etudid) + return REQUEST.RESPONSE.redirect( + context.NotesURL() + "/ficheEtud?etudid=" + etudid + ) else: data = tf[2]["datafile"].read() descr = tf[2]["description"] @@ -172,7 +174,9 @@ def etud_upload_file_form(context, REQUEST, etudid): _store_etud_file_to_new_archive( context, REQUEST, etudid, data, filename, description=descr ) - return REQUEST.RESPONSE.redirect(REQUEST.URL1 + "/ficheEtud?etudid=" + etudid) + return REQUEST.RESPONSE.redirect( + context.NotesURL() + "/ficheEtud?etudid=" + etudid + ) def _store_etud_file_to_new_archive( diff --git a/sco_edit_formation.py b/sco_edit_formation.py index 84fde691..6d249230 100644 --- a/sco_edit_formation.py +++ b/sco_edit_formation.py @@ -62,7 +62,7 @@ def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST '
  • %(titremois)s
  • ' % sem ) - H.append('

    Revenir

    ' % REQUEST.URL1) + H.append('

    Revenir

    ' % context.NotesURL()) else: if not dialog_confirmed: return context.confirmDialog( @@ -73,7 +73,7 @@ def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST % F, REQUEST=REQUEST, OK="Supprimer cette formation", - cancel_url=REQUEST.URL1, + cancel_url=context.NotesURL(), parameters={"formation_id": formation_id}, ) else: @@ -81,7 +81,7 @@ def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST H.append( """

    OK, formation supprimée.

    continuer

    """ - % REQUEST.URL1 + % context.NotesURL() ) H.append(context.sco_footer(REQUEST)) @@ -191,7 +191,7 @@ def formation_edit(context, formation_id=None, create=False, REQUEST=None): if tf[0] == 0: return "\n".join(H) + tf[1] + context.sco_footer(REQUEST) elif tf[0] == -1: - return REQUEST.RESPONSE.redirect(REQUEST.URL1) + return REQUEST.RESPONSE.redirect(context.NotesURL()) else: # check unicity : constraint UNIQUE(acronyme,titre,version) if create: diff --git a/sco_edit_matiere.py b/sco_edit_matiere.py index a0eec6f6..98a86dfe 100644 --- a/sco_edit_matiere.py +++ b/sco_edit_matiere.py @@ -75,7 +75,7 @@ associé. submitlabel="Créer cette matière", ) - dest_url = REQUEST.URL1 + "/ue_list?formation_id=" + UE["formation_id"] + dest_url = context.NotesURL() + "/ue_list?formation_id=" + UE["formation_id"] if tf[0] == 0: return "\n".join(H) + tf[1] + context.sco_footer(REQUEST) @@ -104,7 +104,7 @@ def matiere_delete(context, matiere_id=None, REQUEST=None): "

    Suppression de la matière %(titre)s" % M, " dans l'UE (%(acronyme)s))

    " % UE, ] - + dest_url = context.NotesURL() + "/ue_list?formation_id=" + str(UE["formation_id"]) tf = TrivialFormulator( REQUEST.URL0, REQUEST.form, @@ -116,12 +116,10 @@ def matiere_delete(context, matiere_id=None, REQUEST=None): if tf[0] == 0: return "\n".join(H) + tf[1] + context.sco_footer(REQUEST) elif tf[0] == -1: - return REQUEST.RESPONSE.redirect(REQUEST.URL1) + return REQUEST.RESPONSE.redirect(dest_url) else: context.do_matiere_delete(matiere_id, REQUEST) - return REQUEST.RESPONSE.redirect( - REQUEST.URL1 + "/ue_list?formation_id=" + str(UE["formation_id"]) - ) + return REQUEST.RESPONSE.redirect(dest_url) def matiere_edit(context, matiere_id=None, REQUEST=None): @@ -181,7 +179,7 @@ associé. submitlabel="Modifier les valeurs", ) - dest_url = REQUEST.URL1 + "/ue_list?formation_id=" + U["formation_id"] + dest_url = context.NotesURL() + "/ue_list?formation_id=" + U["formation_id"] if tf[0] == 0: return "\n".join(H) + tf[1] + help + context.sco_footer(REQUEST) diff --git a/sco_edit_module.py b/sco_edit_module.py index 899f04f0..54ab900b 100644 --- a/sco_edit_module.py +++ b/sco_edit_module.py @@ -174,7 +174,7 @@ def module_create(context, matiere_id=None, REQUEST=None): else: context.do_module_create(tf[2], REQUEST) return REQUEST.RESPONSE.redirect( - REQUEST.URL1 + "/ue_list?formation_id=" + UE["formation_id"] + context.NotesURL() + "/ue_list?formation_id=" + UE["formation_id"] ) @@ -191,7 +191,7 @@ def module_delete(context, module_id=None, REQUEST=None): """

    Suppression du module %(titre)s (%(code)s)

    """ % Mod, ] - dest_url = REQUEST.URL1 + "/ue_list?formation_id=" + Mod["formation_id"] + dest_url = context.NotesURL() + "/ue_list?formation_id=" + Mod["formation_id"] tf = TrivialFormulator( REQUEST.URL0, REQUEST.form, @@ -240,7 +240,7 @@ def module_edit(context, module_id=None, REQUEST=None): semestres_indices = range(1, parcours.NB_SEM + 1) - dest_url = REQUEST.URL1 + "/ue_list?formation_id=" + Mod["formation_id"] + dest_url = context.NotesURL() + "/ue_list?formation_id=" + Mod["formation_id"] H = [ context.sco_header( diff --git a/sco_edit_ue.py b/sco_edit_ue.py index 745a9920..8aaf3737 100644 --- a/sco_edit_ue.py +++ b/sco_edit_ue.py @@ -221,7 +221,7 @@ def ue_edit(context, ue_id=None, create=False, formation_id=None, REQUEST=None): else: do_ue_edit(context, tf[2]) return REQUEST.RESPONSE.redirect( - REQUEST.URL1 + "/ue_list?formation_id=" + formation_id + context.NotesURL() + "/ue_list?formation_id=" + formation_id ) diff --git a/sco_formsemestre_custommenu.py b/sco_formsemestre_custommenu.py index 3b3a38ab..72e44bd4 100644 --- a/sco_formsemestre_custommenu.py +++ b/sco_formsemestre_custommenu.py @@ -80,6 +80,9 @@ def formsemestre_custommenu_html(context, formsemestre_id, base_url=""): def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None): """Dialog to edit the custom menu""" sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) + dest_url = ( + context.NotesURL() + "formsemestre_status?formsemestre_id=%s" % formsemestre_id + ) H = [ context.html_sem_header(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.

    @@ -126,7 +129,7 @@ def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None): if tf[0] == 0: return "\n".join(H) + "\n" + tf[1] + context.sco_footer(REQUEST) elif tf[0] == -1: - return REQUEST.RESPONSE.redirect(REQUEST.URL1) + return REQUEST.RESPONSE.redirect(dest_url) else: # form submission cnx = context.GetDBConnexion() @@ -153,6 +156,4 @@ def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None): "url": tf[2]["url_" + custommenu_id], }, ) - REQUEST.RESPONSE.redirect( - "formsemestre_status?formsemestre_id=%s" % formsemestre_id - ) + REQUEST.RESPONSE.redirect(dest_url) diff --git a/sco_formsemestre_edit.py b/sco_formsemestre_edit.py index 2a05e2f5..556b5121 100644 --- a/sco_formsemestre_edit.py +++ b/sco_formsemestre_edit.py @@ -72,9 +72,7 @@ def formsemestre_createwithmodules(context, REQUEST=None): def formsemestre_editwithmodules(context, REQUEST, formsemestre_id): """Page modification semestre""" # portage from dtml - authuser = REQUEST.AUTHENTICATED_USER sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) - F = context.formation_list(args={"formation_id": sem["formation_id"]})[0] H = [ context.html_sem_header( REQUEST, @@ -711,7 +709,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): "formsemestre_id": formsemestre_id, "responsable_id": tf[2][module_id], } - mid = sco_moduleimpl.do_moduleimpl_create(context, modargs) + _ = sco_moduleimpl.do_moduleimpl_create(context, modargs) return REQUEST.RESPONSE.redirect( "formsemestre_status?formsemestre_id=%s&head_message=Nouveau%%20semestre%%20créé" % formsemestre_id @@ -848,7 +846,6 @@ def formsemestre_clone(context, formsemestre_id, REQUEST=None): """ Formulaire clonage d'un semestre """ - authuser = REQUEST.AUTHENTICATED_USER sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) # Liste des enseignants avec forme pour affichage / saisie avec suggestion userlist = context.Users.get_userlist() @@ -1019,7 +1016,7 @@ def do_formsemestre_clone( args = e.copy() del args["jour"] # erase date args["moduleimpl_id"] = mid - evaluation_id = context.do_evaluation_create(REQUEST=REQUEST, **args) + _ = context.do_evaluation_create(REQUEST=REQUEST, **args) # 3- copy uecoefs objs = sco_formsemestre.formsemestre_uecoef_list( @@ -1028,7 +1025,7 @@ def do_formsemestre_clone( for obj in objs: args = obj.copy() args["formsemestre_id"] = formsemestre_id - c = sco_formsemestre.formsemestre_uecoef_create(cnx, args) + _ = sco_formsemestre.formsemestre_uecoef_create(cnx, args) # NB: don't copy notes_formsemestre_custommenu (usually specific) @@ -1051,7 +1048,7 @@ def do_formsemestre_clone( for obj in objs: args = obj.copy() args["formsemestre_id"] = formsemestre_id - c = sco_compute_moy.formsemestre_ue_computation_expr_create(cnx, args) + _ = sco_compute_moy.formsemestre_ue_computation_expr_create(cnx, args) # 5- Copy partitions if clone_partitions: @@ -1061,7 +1058,6 @@ def do_formsemestre_clone( for part in sco_groups.get_partitions_list(context, orig_formsemestre_id): if part["partition_name"] != None: partname = part["partition_name"] - orig_partition_id = part["partition_id"] new_partition_id = sco_groups.partition_create( context, formsemestre_id, @@ -1081,7 +1077,7 @@ def do_formsemestre_clone( if newpart["partition_id"] == g[0]: part_id = g[0] for group_name in g[1]: - group_id = sco_groups.createGroup( + _ = sco_groups.createGroup( context, part_id, group_name=group_name, REQUEST=REQUEST ) @@ -1263,7 +1259,11 @@ def formsemestre_delete(context, formsemestre_id, REQUEST=None): H.append(tf[1]) return "\n".join(H) + context.sco_footer(REQUEST) elif tf[0] == -1: # cancel - return REQUEST.RESPONSE.redirect(REQUEST.URL1) + return REQUEST.RESPONSE.redirect( + context.NotesURL() + + "formsemestre_status?formsemestre_id=" + + formsemestre_id + ) else: return REQUEST.RESPONSE.redirect( "formsemestre_delete2?formsemestre_id=" + formsemestre_id @@ -1274,9 +1274,6 @@ def formsemestre_delete2( context, formsemestre_id, dialog_confirmed=False, REQUEST=None ): """Delete a formsemestre (confirmation)""" - sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) - F = context.formation_list(args={"formation_id": sem["formation_id"]})[0] - H = [context.html_sem_header(REQUEST, "Suppression du semestre", sem)] # Confirmation dialog if not dialog_confirmed: return context.confirmDialog( @@ -1288,7 +1285,9 @@ def formsemestre_delete2( ) # Bon, s'il le faut... do_formsemestre_delete(context, formsemestre_id, REQUEST) - return REQUEST.RESPONSE.redirect(REQUEST.URL2 + "?head_message=Semestre%20supprimé") + return REQUEST.RESPONSE.redirect( + context.ScoURL() + "?head_message=Semestre%20supprimé" + ) def formsemestre_has_decisions_or_compensations(context, formsemestre_id): @@ -1491,7 +1490,6 @@ def formsemestre_edit_uecoefs(context, formsemestre_id, err_ue_id=None, REQUEST= if not ok: return err sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) - F = context.formation_list(args={"formation_id": sem["formation_id"]})[0] footer = context.sco_footer(REQUEST) help = """

    diff --git a/sco_groups.py b/sco_groups.py index 26a2e677..c4746f60 100644 --- a/sco_groups.py +++ b/sco_groups.py @@ -1185,6 +1185,8 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None): """ partition = get_partition(context, partition_id) formsemestre_id = partition["formsemestre_id"] + # renvoie sur page édition groupes + dest_url = "affectGroups?partition_id=%s" % partition_id if not can_change_groups(context, REQUEST, formsemestre_id): raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !") sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) @@ -1225,7 +1227,7 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None): if tf[0] == 0: return "\n".join(H) + "\n" + tf[1] + context.sco_footer(REQUEST) elif tf[0] == -1: - return REQUEST.RESPONSE.redirect(REQUEST.URL1) + return REQUEST.RESPONSE.redirect(dest_url) else: # form submission log( @@ -1279,8 +1281,7 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None): context, etudid, group_id, partition, REQUEST=REQUEST ) log("%s in group %s" % (etudid, group_id)) - # envoie sur page edition groupes - return REQUEST.RESPONSE.redirect("affectGroups?partition_id=%s" % partition_id) + return REQUEST.RESPONSE.redirect(dest_url) def get_prev_moy(context, etudid, formsemestre_id): diff --git a/sco_placement.py b/sco_placement.py index 3c50b19f..9487db08 100644 --- a/sco_placement.py +++ b/sco_placement.py @@ -217,7 +217,9 @@ def do_placement_selectetuds(context, REQUEST): ) + "&".join(gs) ) - return REQUEST.RESPONSE.redirect(REQUEST.URL1 + "/do_placement?" + query) + return REQUEST.RESPONSE.redirect( + context.NotesURL() + "/do_placement?" + query + ) else: raise ValueError( "invalid placement_method (%s)" % tf[2]["placement_method"] diff --git a/sco_preferences.py b/sco_preferences.py index d7bb3ed3..49b29ff9 100644 --- a/sco_preferences.py +++ b/sco_preferences.py @@ -1943,13 +1943,13 @@ class sco_base_preferences: if tf[0] == 0: return "\n".join(H) + tf[1] + self.context.sco_footer(REQUEST) elif tf[0] == -1: - return REQUEST.RESPONSE.redirect(REQUEST.URL1) # cancel + return REQUEST.RESPONSE.redirect(self.context.ScoURL()) # cancel else: for pref in PREFS: self.prefs[None][pref[0]] = tf[2][pref[0]] self.save() return REQUEST.RESPONSE.redirect( - REQUEST.URL1 + "?head_message=Préférences modifiées" + self.context.ScoURL() + "?head_message=Préférences modifiées" ) @@ -1991,7 +1991,6 @@ class sem_preferences: # The dialog def edit(self, categories=[], REQUEST=None): """Dialog to edit semestre preferences in given categories""" - # log('XXX edit') if not self.formsemestre_id: raise ScoValueError( "sem_preferences.edit doit etre appele sur un semestre !" @@ -2038,7 +2037,6 @@ function set_global_pref(el, pref_name) { form.append(("create_local", {"input_type": "hidden"})) form.append(("destination", {"input_type": "hidden"})) form.append(("formsemestre_id", {"input_type": "hidden"})) - # log('REQUEST form=%s'%REQUEST.form) tf = TrivialFormulator( REQUEST.URL0, REQUEST.form, @@ -2047,17 +2045,19 @@ function set_global_pref(el, pref_name) { cssclass="sco_pref", submitlabel="Enregistrer les modifications", ) + dest_url = ( + self.context.NotesURL() + + "formsemestre_status?formsemestre_id=%s" % self.formsemestre_id + ) if tf[0] == 0: return "\n".join(H) + tf[1] + self.context.sco_footer(REQUEST) elif tf[0] == -1: return REQUEST.RESPONSE.redirect( - REQUEST.URL1 + "?head_message=Annulé" + dest_url + "&head_message=Annulé" ) # cancel else: - # log('tf[2]=%s' % tf[2]) # XXX # Supprime pref locale du semestre (retour à la valeur globale) if tf[2]["suppress"]: - # log('suppress %s' % tf[2]['suppress']) # XXX self.base_prefs.delete(self.formsemestre_id, tf[2]["suppress"]) # Cree pref local (copie valeur globale) if tf[2]["create_local"]: @@ -2089,9 +2089,7 @@ function set_global_pref(el, pref_name) { destination = tf[2]["destination"] if destination == "done" or destination == "": return REQUEST.RESPONSE.redirect( - REQUEST.URL1 - + "/formsemestre_status?head_message=Préférences modifiées&formsemestre_id=" - + self.formsemestre_id + dest_url + "&head_message=Préférences modifiées" ) elif destination == "again": return REQUEST.RESPONSE.redirect(