diff --git a/app/auth/models.py b/app/auth/models.py index bd387548..8ee5bef7 100644 --- a/app/auth/models.py +++ b/app/auth/models.py @@ -159,7 +159,7 @@ class User(UserMixin, db.Model): """ for field in ["nom", "prenom", "dept", "active", "email", "date_expiration"]: if field in data: - setattr(self, field, data[field]) + setattr(self, field, data[field] or None) if new_user: if "user_name" in data: # never change name of existing users diff --git a/app/scodoc/TrivialFormulator.py b/app/scodoc/TrivialFormulator.py index e8871b12..d780643d 100644 --- a/app/scodoc/TrivialFormulator.py +++ b/app/scodoc/TrivialFormulator.py @@ -562,18 +562,11 @@ class TF(object): '') % values) + lem.append('value="%(' + field + ')s" />' % values) suggest_js.append( - """var %s_opts = %s; - var %s_as = new bsn.AutoSuggest('%s', %s_opts); - """ - % ( - field, - dict2js(descr.get("text_suggest_options", {})), - field, - field, - field, - ) + f"""var {field}_opts = {dict2js(descr.get("text_suggest_options", {}))}; +var {field}_as = new bsn.AutoSuggest('{field}', {field}_opts); +""" ) else: raise ValueError("unkown input_type for form (%s)!" % input_type) diff --git a/app/scodoc/sco_formsemestre_edit.py b/app/scodoc/sco_formsemestre_edit.py index 6d4120c6..cfd7d51c 100644 --- a/app/scodoc/sco_formsemestre_edit.py +++ b/app/scodoc/sco_formsemestre_edit.py @@ -200,7 +200,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): NB_SEM = parcours.NB_SEM else: NB_SEM = 10 # fallback, max 10 semestres - semestre_id_list = [-1] + [str(x) for x in range(1, NB_SEM + 1)] + semestre_id_list = ["-1"] + [str(x) for x in range(1, NB_SEM + 1)] semestre_id_labels = [] for sid in semestre_id_list: if sid == "-1": @@ -578,7 +578,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False): itemtemplate = """