fix redirect

This commit is contained in:
Emmanuel Viennet 2021-07-05 23:32:57 +02:00
parent 4d637db3fc
commit 716f1f8b73

View File

@ -75,10 +75,13 @@ def formsemestre_createwithmodules(context, REQUEST=None):
bodyOnLoad="init_tf_form('')",
),
"""<h2>Mise en place d'un semestre de formation</h2>""",
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(
"""<p class="help">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