Update opolka/ScoDoc from ScoDoc/ScoDoc #2

Merged
opolka merged 1272 commits from ScoDoc/ScoDoc:master into master 2024-05-27 09:11:04 +02:00
3 changed files with 13 additions and 12 deletions
Showing only changes of commit 772293e06f - Show all commits

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 = "" buttons_markup = ""
if self.submitbutton: if self.submitbutton:
buttons_markup += ( 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,
self.formid, self.formid,
@ -471,9 +471,9 @@ class TF(object):
R.append( R.append(
f"""<input type="hidden" name="csrf_token" value="{ f"""<input type="hidden" name="csrf_token" value="{
flask_wtf.csrf.generate_csrf() 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: if self.top_buttons:
R.append(buttons_markup + "<p></p>") R.append(buttons_markup + "<p></p>")
R.append(self.before_table.format(title=self.title)) R.append(self.before_table.format(title=self.title))
@ -524,7 +524,7 @@ class TF(object):
else: else:
checked = "" checked = ""
lab.append( 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) % ("tf-checked", field, checked)
) )
if title_bubble: if title_bubble:
@ -663,12 +663,12 @@ class TF(object):
if descr.get("type", "") == "list": if descr.get("type", "") == "list":
for v in values[field]: for v in values[field]:
lem.append( lem.append(
'<input type="hidden" name="%s:list" value="%s" %s >' '<input type="hidden" name="%s:list" value="%s" %s />'
% (field, v, attribs) % (field, v, attribs)
) )
else: else:
lem.append( 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) % (field, wid, values[field], attribs)
) )
elif (input_type == "separator") or (input_type == "table_separator"): elif (input_type == "separator") or (input_type == "table_separator"):
@ -839,7 +839,7 @@ var {field}_as = new bsn.AutoSuggest('{field}', {field}_opts);
bool_val = 0 bool_val = 0
R.append(labels[bool_val]) R.append(labels[bool_val])
if 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: else:
labels = descr.get("labels", descr["allowed_values"]) labels = descr.get("labels", descr["allowed_values"])
for i in range(len(labels)): for i in range(len(labels)):
@ -858,7 +858,7 @@ var {field}_as = new bsn.AutoSuggest('{field}', {field}_opts);
elif input_type == "file": elif input_type == "file":
R.append("'%s'" % self.values[field]) R.append("'%s'" % self.values[field])
else: 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", "") explanation = descr.get("explanation", "")
if 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) all_roles = int(all_roles)
H = [ H = [
html_sco_header.sco_header( html_sco_header.sco_header(
bodyOnLoad="init_tf_form('')",
javascripts=["js/user_form.js"], javascripts=["js/user_form.js"],
) )
] ]