diff --git a/ZEntreprises.py b/ZEntreprises.py index 3da1ea12..dd7f5047 100644 --- a/ZEntreprises.py +++ b/ZEntreprises.py @@ -562,7 +562,7 @@ class ZEntreprises( % entreprise_contact_id ) elif tf[0] == -1: - REQUEST.RESPONSE.redirect(self.EntreprisesURL()) + return REQUEST.RESPONSE.redirect(self.EntreprisesURL()) else: etudok = sco_entreprises.do_entreprise_check_etudiant( self, tf[2]["etudiant"] @@ -572,7 +572,7 @@ class ZEntreprises( else: tf[2].update({"etudid": etudok[1]}) sco_entreprises.do_entreprise_contact_edit(self, tf[2]) - REQUEST.RESPONSE.redirect( + return REQUEST.RESPONSE.redirect( self.EntreprisesURL() + "/entreprise_contact_list?entreprise_id=" + str(c["entreprise_id"]) @@ -680,13 +680,13 @@ class ZEntreprises( if tf[0] == 0: H.append(tf[1]) elif tf[0] == -1: - REQUEST.RESPONSE.redirect( + return REQUEST.RESPONSE.redirect( "%s/entreprise_correspondant_list?entreprise_id=%s" % (self.EntreprisesURL(), c["entreprise_id"]) ) else: sco_entreprises.do_entreprise_correspondant_edit(self, tf[2]) - REQUEST.RESPONSE.redirect( + return REQUEST.RESPONSE.redirect( "%s/entreprise_correspondant_list?entreprise_id=%s" % (self.EntreprisesURL(), c["entreprise_id"]) ) @@ -789,7 +789,7 @@ class ZEntreprises( if tf[0] == 0: H.append(tf[1]) elif tf[0] == -1: - REQUEST.RESPONSE.redirect(self.EntreprisesURL()) + return REQUEST.RESPONSE.redirect(self.EntreprisesURL()) else: etudok = sco_entreprises.do_entreprise_check_etudiant( self, tf[2]["etudiant"] @@ -799,7 +799,7 @@ class ZEntreprises( else: tf[2].update({"etudid": etudok[1]}) sco_entreprises.do_entreprise_contact_create(self, tf[2]) - REQUEST.RESPONSE.redirect(self.EntreprisesURL()) + return REQUEST.RESPONSE.redirect(self.EntreprisesURL()) H.append(entreprise_footer(self, REQUEST)) return "\n".join(H) @@ -828,12 +828,12 @@ class ZEntreprises( if tf[0] == 0: H.append(tf[1]) elif tf[0] == -1: - REQUEST.RESPONSE.redirect(self.EntreprisesURL()) + return REQUEST.RESPONSE.redirect(self.EntreprisesURL()) else: sco_entreprises.do_entreprise_contact_delete( self, c["entreprise_contact_id"] ) - REQUEST.RESPONSE.redirect(self.EntreprisesURL()) + return REQUEST.RESPONSE.redirect(self.EntreprisesURL()) H.append(entreprise_footer(self, REQUEST)) return "\n".join(H) @@ -935,10 +935,10 @@ class ZEntreprises( if tf[0] == 0: H.append(tf[1]) elif tf[0] == -1: - REQUEST.RESPONSE.redirect(self.EntreprisesURL()) + return REQUEST.RESPONSE.redirect(self.EntreprisesURL()) else: sco_entreprises.do_entreprise_correspondant_create(self, tf[2]) - REQUEST.RESPONSE.redirect(self.EntreprisesURL()) + return REQUEST.RESPONSE.redirect(self.EntreprisesURL()) H.append(entreprise_footer(self, REQUEST)) return "\n".join(H) @@ -967,12 +967,12 @@ class ZEntreprises( if tf[0] == 0: H.append(tf[1]) elif tf[0] == -1: - REQUEST.RESPONSE.redirect(self.EntreprisesURL()) + return REQUEST.RESPONSE.redirect(self.EntreprisesURL()) else: sco_entreprises.do_entreprise_correspondant_delete( self, c["entreprise_corresp_id"] ) - REQUEST.RESPONSE.redirect(self.EntreprisesURL()) + return REQUEST.RESPONSE.redirect(self.EntreprisesURL()) H.append(entreprise_footer(self, REQUEST)) return "\n".join(H) @@ -1025,10 +1025,10 @@ class ZEntreprises( if tf[0] == 0: H.append(tf[1]) elif tf[0] == -1: - REQUEST.RESPONSE.redirect(self.EntreprisesURL()) + return REQUEST.RESPONSE.redirect(self.EntreprisesURL()) else: sco_entreprises.do_entreprise_delete(self, E["entreprise_id"]) - REQUEST.RESPONSE.redirect(self.EntreprisesURL()) + return REQUEST.RESPONSE.redirect(self.EntreprisesURL()) H.append(entreprise_footer(self, REQUEST)) return "\n".join(H) diff --git a/ZNotes.py b/ZNotes.py index 553f3538..f78684d9 100644 --- a/ZNotes.py +++ b/ZNotes.py @@ -169,7 +169,7 @@ class ZNotes(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Impl "Changes the instance values" self.title = title self._p_changed = 1 - RESPONSE.redirect("manage_editForm") + return RESPONSE.redirect("manage_editForm") def _getNotesCache(self): "returns CacheNotesTable instance for us" diff --git a/ZScoDoc.py b/ZScoDoc.py index 3de841af..59a26a6c 100644 --- a/ZScoDoc.py +++ b/ZScoDoc.py @@ -399,7 +399,7 @@ class ZScoDoc(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp except: admin_password_initialized = "0" if isAdmin and admin_password_initialized != "1": - REQUEST.RESPONSE.redirect( + return REQUEST.RESPONSE.redirect( "ScoDoc/change_admin_user_form?message=Le%20mot%20de%20passe%20administrateur%20doit%20etre%20change%20!" ) diff --git a/ZScoUsers.py b/ZScoUsers.py index 2550bb4f..efe1eb97 100644 --- a/ZScoUsers.py +++ b/ZScoUsers.py @@ -1072,7 +1072,7 @@ class ZScoUsers( parameters={"user_name": user_name}, ) self._user_delete(user_name) - REQUEST.RESPONSE.redirect( + return REQUEST.RESPONSE.redirect( self.UsersURL() + r"?head_message=Utilisateur%20supprimé" ) diff --git a/ZScolar.py b/ZScolar.py index 0537b67e..f61d6a43 100644 --- a/ZScolar.py +++ b/ZScolar.py @@ -206,11 +206,11 @@ class ZScolar(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp # The for used to edit this object security.declareProtected(ScoView, "manage_editZScolar") - def manage_editZScolar(self, title, RESPONSE=None): + def manage_editZScolar(self, title, REQUEST=None): "Changes the instance values" self.title = title self._p_changed = 1 - RESPONSE.redirect("manage_editForm") + return REQUEST.RESPONSE.redirect("manage_editForm") def _setup_initial_roles_and_permissions(self): """Initialize roles and permissions @@ -321,43 +321,43 @@ REQUEST.URL0=%s
# essai: liste des permissions # from AccessControl import getSecurityManager # pylint: disable=import-error - from AccessControl.Permission import Permission # pylint: disable=import-error + # from AccessControl.Permission import Permission # pylint: disable=import-error - permissions = self.ac_inherited_permissions(1) - scoperms = [p for p in permissions if p[0][:3] == "Sco"] - # H.append( str(self.aq_parent.aq_parent.permission_settings()) ) - # H.append('

perms: %s

'%str(scoperms)) - # H.append('

valid_roles: %s

'%str(self.valid_roles())) - # H.append('

ac_inherited_permissions=%s

'%str(self.ac_inherited_permissions(1))) - def collect_roles(context, rd): - for p in scoperms: - name, value = p[:2] - P = Permission(name, value, context) - roles = list(P.getRoles()) - if rd.has_key(name): - rd[name] += roles - else: - rd[name] = roles - if hasattr(context, "aq_parent"): - collect_roles(context.aq_parent, rd) + # permissions = self.ac_inherited_permissions(1) + # scoperms = [p for p in permissions if p[0][:3] == "Sco"] + # # H.append( str(self.aq_parent.aq_parent.permission_settings()) ) + # # H.append('

perms: %s

'%str(scoperms)) + # # H.append('

valid_roles: %s

'%str(self.valid_roles())) + # # H.append('

ac_inherited_permissions=%s

'%str(self.ac_inherited_permissions(1))) + # def collect_roles(context, rd): + # for p in scoperms: + # name, value = p[:2] + # P = Permission(name, value, context) + # roles = list(P.getRoles()) + # if rd.has_key(name): + # rd[name] += roles + # else: + # rd[name] = roles + # if hasattr(context, "aq_parent"): + # collect_roles(context.aq_parent, rd) - b = "" - rd = {} - collect_roles(self, rd) - b = "

" + str(rd) + "

" + # b = "" + # rd = {} + # collect_roles(self, rd) + # b = "

" + str(rd) + "

" - authuser = REQUEST.AUTHENTICATED_USER - for p in scoperms: - permname, _ = p[:2] - b += "

" + permname + " : " - if authuser.has_permission(permname, self): - b += "yes" - else: - b += "no" - b += "

" - b += "

xxx


" + str(self.aq_parent.aq_parent) + # authuser = REQUEST.AUTHENTICATED_USER + # for p in scoperms: + # permname, _ = p[:2] + # b += "

" + permname + " : " + # if authuser.has_permission(permname, self): + # b += "yes" + # else: + # b += "no" + # b += "

" + # b += "

xxx


" + str(self.aq_parent.aq_parent) - return self.sco_header(REQUEST) + str(b) + self.sco_footer(REQUEST) + # return self.sco_header(REQUEST) + str(b) + self.sco_footer(REQUEST) # essais calendriers: security.declareProtected(ScoView, "experimental_calendar") @@ -1122,7 +1122,7 @@ REQUEST.URL0=%s
}, ) logdb(REQUEST, cnx, method="addAnnotation", etudid=etudid) - REQUEST.RESPONSE.redirect("ficheEtud?etudid=" + etudid) + return REQUEST.RESPONSE.redirect("ficheEtud?etudid=" + etudid) security.declareProtected(ScoView, "canSuppressAnnotation") @@ -1161,7 +1161,7 @@ REQUEST.URL0=%s
logdb(REQUEST, cnx, method="SuppressAnnotation", etudid=etudid) scolars.etud_annotations_delete(cnx, annotation_id) - REQUEST.RESPONSE.redirect( + return REQUEST.RESPONSE.redirect( "ficheEtud?etudid=%s&head_message=Annotation%%20supprimée" % (etudid) ) @@ -1231,7 +1231,7 @@ REQUEST.URL0=%s
else: scolars.adresse_create(cnx, args=tf[2]) logdb(REQUEST, cnx, method="changeCoordonnees", etudid=etudid) - REQUEST.RESPONSE.redirect(dest_url) + return REQUEST.RESPONSE.redirect(dest_url) # --- Gestion des groupes: security.declareProtected(ScoView, "affectGroups") diff --git a/sco_edit_module.py b/sco_edit_module.py index 54ab900b..1b15984e 100644 --- a/sco_edit_module.py +++ b/sco_edit_module.py @@ -452,7 +452,7 @@ def formation_add_malus_modules(context, formation_id, titre=None, REQUEST=None) ue_add_malus_module(context, ue["ue_id"], titre=titre, REQUEST=REQUEST) if REQUEST: - REQUEST.RESPONSE.redirect("ue_list?formation_id=" + formation_id) + return REQUEST.RESPONSE.redirect("ue_list?formation_id=" + formation_id) def ue_add_malus_module(context, ue_id, titre=None, code=None, REQUEST=None): diff --git a/sco_formsemestre_custommenu.py b/sco_formsemestre_custommenu.py index 72e44bd4..ae828c8d 100644 --- a/sco_formsemestre_custommenu.py +++ b/sco_formsemestre_custommenu.py @@ -156,4 +156,4 @@ def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None): "url": tf[2]["url_" + custommenu_id], }, ) - REQUEST.RESPONSE.redirect(dest_url) + return REQUEST.RESPONSE.redirect(dest_url) diff --git a/sco_formsemestre_edit.py b/sco_formsemestre_edit.py index 556b5121..09e9f44f 100644 --- a/sco_formsemestre_edit.py +++ b/sco_formsemestre_edit.py @@ -1438,7 +1438,7 @@ def formsemestre_change_lock( args = {"formsemestre_id": formsemestre_id, "etat": etat} context.do_formsemestre_edit(args) if REQUEST: - REQUEST.RESPONSE.redirect( + return REQUEST.RESPONSE.redirect( "formsemestre_status?formsemestre_id=%s" % formsemestre_id ) @@ -1478,9 +1478,10 @@ def formsemestre_change_publication_bul( args = {"formsemestre_id": formsemestre_id, "bul_hide_xml": etat} context.do_formsemestre_edit(args) if REQUEST: - REQUEST.RESPONSE.redirect( + return REQUEST.RESPONSE.redirect( "formsemestre_status?formsemestre_id=%s" % formsemestre_id ) + return None def formsemestre_edit_uecoefs(context, formsemestre_id, err_ue_id=None, REQUEST=None): diff --git a/sco_formsemestre_validation.py b/sco_formsemestre_validation.py index 5bda7b0e..97b67a6f 100644 --- a/sco_formsemestre_validation.py +++ b/sco_formsemestre_validation.py @@ -346,7 +346,7 @@ def formsemestre_validation_etud( raise ValueError("code choix invalide ! (%s)" % codechoice) # Se.valide_decision(choice, REQUEST) # enregistre - _redirect_valid_choice( + return _redirect_valid_choice( formsemestre_id, etudid, Se, choice, desturl, sortcol, REQUEST ) @@ -393,7 +393,7 @@ def formsemestre_validation_etud_manu( # Se.valide_decision(choice, REQUEST) # enregistre if redirect: - _redirect_valid_choice( + return _redirect_valid_choice( formsemestre_id, etudid, Se, choice, desturl, sortcol, REQUEST ) @@ -407,9 +407,9 @@ def _redirect_valid_choice( ) if sortcol: adr += "&sortcol=" + sortcol - if desturl: - desturl += "&desturl=" + desturl - REQUEST.RESPONSE.redirect(adr) + # if desturl: + # desturl += "&desturl=" + desturl + return REQUEST.RESPONSE.redirect(adr) # Si le precedent a été modifié, demande relecture du parcours. # sinon renvoie au listing general, diff --git a/sco_moduleimpl_inscriptions.py b/sco_moduleimpl_inscriptions.py index 3a4c535b..43327b24 100644 --- a/sco_moduleimpl_inscriptions.py +++ b/sco_moduleimpl_inscriptions.py @@ -183,7 +183,7 @@ def moduleimpl_inscriptions_edit( sco_moduleimpl.do_moduleimpl_inscrit_etuds( context, moduleimpl_id, formsemestre_id, etuds, reset=True, REQUEST=REQUEST ) - REQUEST.RESPONSE.redirect( + return REQUEST.RESPONSE.redirect( "moduleimpl_status?moduleimpl_id=%s" % (moduleimpl_id) ) # diff --git a/sco_saisie_notes.py b/sco_saisie_notes.py index 9602faea..7decaf79 100644 --- a/sco_saisie_notes.py +++ b/sco_saisie_notes.py @@ -949,9 +949,15 @@ def saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None): H.append("""""") # Le formulaire de saisie des notes: - form = _form_saisie_notes(context, E, M, groups_infos.group_ids, REQUEST=REQUEST) + destination = "%s/Notes/moduleimpl_status?moduleimpl_id=%s" % ( + context.ScoURL(), + E["moduleimpl_id"], + ) + form = _form_saisie_notes( + context, E, M, groups_infos.group_ids, destination=destination, REQUEST=REQUEST + ) if form is None: - return "" # redirect + return REQUEST.RESPONSE.redirect(destination) H.append(form) # H.append("") # /saisie_notes @@ -1041,7 +1047,7 @@ def _get_sorted_etuds(context, E, etudids, formsemestre_id): return etuds -def _form_saisie_notes(context, E, M, group_ids, REQUEST=None): +def _form_saisie_notes(context, E, M, group_ids, destination="", REQUEST=None): """Formulaire HTML saisie des notes dans l'évaluation E du moduleimpl M pour les groupes indiqués. @@ -1176,11 +1182,6 @@ def _form_saisie_notes(context, E, M, group_ids, REQUEST=None): ) # H.append('''

''') - destination = "%s/Notes/moduleimpl_status?moduleimpl_id=%s" % ( - context.ScoURL(), - M["moduleimpl_id"], - ) - tf = TF( destination, REQUEST.form, @@ -1191,7 +1192,6 @@ def _form_saisie_notes(context, E, M, group_ids, REQUEST=None): ) H.append(tf.getform()) # check and init if tf.canceled(): - REQUEST.RESPONSE.redirect(destination) return None elif (not tf.submitted()) or not tf.result: # ajout formularie saisie notes manquantes @@ -1213,7 +1213,6 @@ def _form_saisie_notes(context, E, M, group_ids, REQUEST=None): else: # form submission # rien à faire - REQUEST.RESPONSE.redirect(destination) return None