Qq corrections cosmétiques du HTML + config mypy

This commit is contained in:
Emmanuel Viennet 2023-12-07 15:34:49 +01:00
parent cf3319dcc0
commit 772293e06f
3 changed files with 13 additions and 12 deletions

2
.mypy.ini Normal file
View File

@ -0,0 +1,2 @@
[mypy-flask_login.*]
ignore_missing_imports = True

View File

@ -429,7 +429,7 @@ class TF(object):
buttons_markup = ""
if self.submitbutton:
buttons_markup += (
'<input type="submit" name="%s_submit" id="%s_submit" value="%s" %s>'
'<input type="submit" name="%s_submit" id="%s_submit" value="%s" %s/>'
% (
self.formid,
self.formid,
@ -471,9 +471,9 @@ class TF(object):
R.append(
f"""<input type="hidden" name="csrf_token" value="{
flask_wtf.csrf.generate_csrf()
}">"""
}"/>"""
)
R.append(f"""<input type="hidden" name="{self.formid}_submitted" value="1">""")
R.append(f"""<input type="hidden" name="{self.formid}_submitted" value="1"/>""")
if self.top_buttons:
R.append(buttons_markup + "<p></p>")
R.append(self.before_table.format(title=self.title))
@ -524,7 +524,7 @@ class TF(object):
else:
checked = ""
lab.append(
'<input type="checkbox" name="%s:list" value="%s" onclick="tf_enable_elem(this)" %s>'
'<input type="checkbox" name="%s:list" value="%s" onclick="tf_enable_elem(this)" %s/>'
% ("tf-checked", field, checked)
)
if title_bubble:
@ -663,12 +663,12 @@ class TF(object):
if descr.get("type", "") == "list":
for v in values[field]:
lem.append(
'<input type="hidden" name="%s:list" value="%s" %s >'
'<input type="hidden" name="%s:list" value="%s" %s />'
% (field, v, attribs)
)
else:
lem.append(
'<input type="hidden" name="%s" id="%s" value="%s" %s >'
'<input type="hidden" name="%s" id="%s" value="%s" %s />'
% (field, wid, values[field], attribs)
)
elif (input_type == "separator") or (input_type == "table_separator"):
@ -746,7 +746,7 @@ var {field}_as = new bsn.AutoSuggest('{field}', {field}_opts);
break;
i = i + 1;
while (i < elem.form.elements.length) {
if ((elem.form.elements[i].type == "text")
if ((elem.form.elements[i].type == "text")
&& (!(elem.form.elements[i].disabled))
&& ($(elem.form.elements[i]).is(':visible')))
{
@ -760,7 +760,7 @@ var {field}_as = new bsn.AutoSuggest('{field}', {field}_opts);
elem.blur();
}
return false;
}
}
else
return true;
}</script>
@ -771,7 +771,7 @@ var {field}_as = new bsn.AutoSuggest('{field}', {field}_opts);
# => only one form with text_suggest field on a page.
R.append(
"""<script type="text/javascript">
function init_tf_form(formid) {
function init_tf_form(formid) {
%s
}
</script>"""
@ -839,7 +839,7 @@ var {field}_as = new bsn.AutoSuggest('{field}', {field}_opts);
bool_val = 0
R.append(labels[bool_val])
if bool_val:
R.append('<input type="hidden" name="%s" value="1">' % field)
R.append(f'<input type="hidden" name="{field}" value="1"/>')
else:
labels = descr.get("labels", descr["allowed_values"])
for i in range(len(labels)):
@ -858,7 +858,7 @@ var {field}_as = new bsn.AutoSuggest('{field}', {field}_opts);
elif input_type == "file":
R.append("'%s'" % self.values[field])
else:
raise ValueError("unkown input_type for form (%s)!" % input_type)
raise ValueError(f"unkown input_type for form ({input_type})!")
explanation = descr.get("explanation", "")
if explanation:

View File

@ -222,7 +222,6 @@ def create_user_form(user_name=None, edit=0, all_roles=True):
all_roles = int(all_roles)
H = [
html_sco_header.sco_header(
bodyOnLoad="init_tf_form('')",
javascripts=["js/user_form.js"],
)
]