Fix: ignore obsolete preferences when cloning a formsemestre

This commit is contained in:
viennet 2020-12-16 01:34:08 +01:00
parent 7194dee09f
commit 99d5d2efd7

View File

@ -101,8 +101,7 @@ def formsemestre_editwithmodules(context, REQUEST, formsemestre_id):
def can_edit_sem(context, REQUEST, formsemestre_id="", sem=None):
"""Return sem if user can edit it, False otherwise
"""
"""Return sem if user can edit it, False otherwise"""
sem = sem or sco_formsemestre.get_formsemestre(context, formsemestre_id)
authuser = REQUEST.AUTHENTICATED_USER
if not authuser.has_permission(ScoImplement, context): # pas chef
@ -808,9 +807,9 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
def formsemestre_delete_moduleimpls(context, formsemestre_id, module_ids_to_del):
"""Delete moduleimpls
module_ids_to_del: list of module_id (warning: not moduleimpl)
Moduleimpls must have no associated evaluations.
"""
module_ids_to_del: list of module_id (warning: not moduleimpl)
Moduleimpls must have no associated evaluations.
"""
ok = True
msg = []
for module_id in module_ids_to_del:
@ -1023,7 +1022,10 @@ def do_formsemestre_clone(
for pname in prefs.base_prefs.prefs[orig_formsemestre_id]:
if not prefs.is_global(pname):
pvalue = prefs[pname]
prefs.base_prefs.set(formsemestre_id, pname, pvalue)
try:
prefs.base_prefs.set(formsemestre_id, pname, pvalue)
except:
log("do_formsemestre_clone: ignoring old preference %s" % pname)
# 5- Copy formules utilisateur
objs = sco_compute_moy.formsemestre_ue_computation_expr_list(
@ -1426,8 +1428,7 @@ def formsemestre_change_lock(
def formsemestre_change_publication_bul(
context, formsemestre_id, REQUEST=None, dialog_confirmed=False
):
"""Change etat publication bulletins sur portail
"""
"""Change etat publication bulletins sur portail"""
ok, err = context._check_access_diretud(formsemestre_id, REQUEST)
if not ok:
return err
@ -1479,8 +1480,7 @@ formsemestre_uecoef_delete = _formsemestre_uecoef_editor.delete
def formsemestre_edit_uecoefs(context, formsemestre_id, err_ue_id=None, REQUEST=None):
"""Changement manuel des coefficients des UE capitalisées.
"""
"""Changement manuel des coefficients des UE capitalisées."""
context = context.Notes # si appele d'en haut, eg par exception ScoValueError
ok, err = context._check_access_diretud(formsemestre_id, REQUEST)
if not ok: