From 716f1f8b73cb2d02e9bd30806a8add50b6f199c7 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 5 Jul 2021 23:32:57 +0200 Subject: [PATCH] fix redirect --- app/scodoc/sco_formsemestre_edit.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/scodoc/sco_formsemestre_edit.py b/app/scodoc/sco_formsemestre_edit.py index 8ce62935..6ac094f7 100644 --- a/app/scodoc/sco_formsemestre_edit.py +++ b/app/scodoc/sco_formsemestre_edit.py @@ -75,10 +75,13 @@ def formsemestre_createwithmodules(context, REQUEST=None): bodyOnLoad="init_tf_form('')", ), """

Mise en place d'un semestre de formation

""", - do_formsemestre_createwithmodules(context, REQUEST=REQUEST), - html_sco_header.sco_footer(context, REQUEST), ] - return "\n".join(H) + r = do_formsemestre_createwithmodules(context, REQUEST=REQUEST) + if isinstance(r, basestring): + H.append(r) + else: + return r # response redirect + return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) def formsemestre_editwithmodules(context, REQUEST, formsemestre_id): @@ -102,7 +105,11 @@ def formsemestre_editwithmodules(context, REQUEST, formsemestre_id): % scu.icontag("lock_img", border="0", title="Semestre verrouillé") ) else: - H.append(do_formsemestre_createwithmodules(context, REQUEST=REQUEST, edit=1)) + r = do_formsemestre_createwithmodules(context, REQUEST=REQUEST, edit=1) + if isinstance(r, basestring): + H.append(r) + else: + return r # response redirect if not REQUEST.form.get("tf-submitted", False): H.append( """

Seuls les modules cochés font partie de ce semestre. Pour les retirer, les décocher et appuyer sur le bouton "modifier". @@ -738,11 +745,10 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): "responsable_id": tf[2][module_id], } _ = sco_moduleimpl.do_moduleimpl_create(context, modargs) - REQUEST.RESPONSE.redirect( + return REQUEST.RESPONSE.redirect( "formsemestre_status?formsemestre_id=%s&head_message=Nouveau%%20semestre%%20créé" % formsemestre_id ) - return "" else: # modification du semestre: # on doit creer les modules nouvellement selectionnés