forked from ScoDoc/ScoDoc
Minor enhancements: error messages
This commit is contained in:
parent
6ecd063bfb
commit
4b0a92a834
@ -61,6 +61,8 @@ def evaluation_create_form(
|
|||||||
"Formulaire création/édition d'une évaluation (pas de ses notes)"
|
"Formulaire création/édition d'une évaluation (pas de ses notes)"
|
||||||
if evaluation_id is not None:
|
if evaluation_id is not None:
|
||||||
evaluation = models.Evaluation.query.get(evaluation_id)
|
evaluation = models.Evaluation.query.get(evaluation_id)
|
||||||
|
if evaluation is None:
|
||||||
|
raise ScoValueError("Cette évaluation n'existe pas ou plus !")
|
||||||
moduleimpl_id = evaluation.moduleimpl_id
|
moduleimpl_id = evaluation.moduleimpl_id
|
||||||
#
|
#
|
||||||
modimpl_o = sco_moduleimpl.moduleimpl_withmodule_list(moduleimpl_id=moduleimpl_id)[
|
modimpl_o = sco_moduleimpl.moduleimpl_withmodule_list(moduleimpl_id=moduleimpl_id)[
|
||||||
|
@ -178,7 +178,7 @@ def can_change_groups(formsemestre_id):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def can_handle_passwd(user, allow_admindepts=False):
|
def can_handle_passwd(user: User, allow_admindepts=False) -> bool:
|
||||||
"""True if the current user can see or change passwd info of user.
|
"""True if the current user can see or change passwd info of user.
|
||||||
If allow_admindepts, allow Admin from all depts (so they can view users from other depts
|
If allow_admindepts, allow Admin from all depts (so they can view users from other depts
|
||||||
and add roles to them).
|
and add roles to them).
|
||||||
@ -199,5 +199,4 @@ def can_handle_passwd(user, allow_admindepts=False):
|
|||||||
return True # if no dept, can access users from all depts !
|
return True # if no dept, can access users from all depts !
|
||||||
if (current_user.dept == user.dept) or allow_admindepts:
|
if (current_user.dept == user.dept) or allow_admindepts:
|
||||||
return True
|
return True
|
||||||
else:
|
return False
|
||||||
return False
|
|
||||||
|
@ -1657,7 +1657,7 @@ def evaluation_delete(evaluation_id):
|
|||||||
"""Form delete evaluation"""
|
"""Form delete evaluation"""
|
||||||
El = sco_evaluation_db.do_evaluation_list(args={"evaluation_id": evaluation_id})
|
El = sco_evaluation_db.do_evaluation_list(args={"evaluation_id": evaluation_id})
|
||||||
if not El:
|
if not El:
|
||||||
raise ScoValueError("Evalution inexistante ! (%s)" % evaluation_id)
|
raise ScoValueError("Evaluation inexistante ! (%s)" % evaluation_id)
|
||||||
E = El[0]
|
E = El[0]
|
||||||
M = sco_moduleimpl.moduleimpl_list(moduleimpl_id=E["moduleimpl_id"])[0]
|
M = sco_moduleimpl.moduleimpl_list(moduleimpl_id=E["moduleimpl_id"])[0]
|
||||||
Mod = sco_edit_module.module_list(args={"module_id": M["module_id"]})[0]
|
Mod = sco_edit_module.module_list(args={"module_id": M["module_id"]})[0]
|
||||||
@ -1750,6 +1750,9 @@ def evaluation_edit(evaluation_id):
|
|||||||
@scodoc7func
|
@scodoc7func
|
||||||
def evaluation_create(moduleimpl_id):
|
def evaluation_create(moduleimpl_id):
|
||||||
"form create evaluation"
|
"form create evaluation"
|
||||||
|
modimpl = ModuleImpl.query.get(moduleimpl_id)
|
||||||
|
if modimpl is None:
|
||||||
|
raise ScoValueError("Ce module n'existe pas ou plus !")
|
||||||
return sco_evaluation_edit.evaluation_create_form(
|
return sco_evaluation_edit.evaluation_create_form(
|
||||||
moduleimpl_id=moduleimpl_id, edit=False
|
moduleimpl_id=moduleimpl_id, edit=False
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user