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
Showing only changes of commit f547b800a1 - Show all commits

View File

@ -237,7 +237,7 @@ class TF(object):
def setdefaultvalues(self): def setdefaultvalues(self):
"set default values and convert numbers to strings" "set default values and convert numbers to strings"
for (field, descr) in self.formdescription: for field, descr in self.formdescription:
# special case for boolcheckbox # special case for boolcheckbox
if descr.get("input_type", None) == "boolcheckbox" and self.submitted(): if descr.get("input_type", None) == "boolcheckbox" and self.submitted():
if field not in self.values: if field not in self.values:
@ -278,7 +278,7 @@ class TF(object):
"check values. Store .result and returns msg" "check values. Store .result and returns msg"
ok = 1 ok = 1
msg = [] msg = []
for (field, descr) in self.formdescription: for field, descr in self.formdescription:
val = self.values[field] val = self.values[field]
# do not check "unckecked" items # do not check "unckecked" items
if descr.get("withcheckbox", False): if descr.get("withcheckbox", False):
@ -287,7 +287,7 @@ class TF(object):
# null values # null values
allow_null = descr.get("allow_null", True) allow_null = descr.get("allow_null", True)
if not allow_null: if not allow_null:
if val == "" or val == None: if val is None or (isinstance(val, str) and not val.strip()):
msg.append( msg.append(
"Le champ '%s' doit être renseigné" % descr.get("title", field) "Le champ '%s' doit être renseigné" % descr.get("title", field)
) )
@ -871,7 +871,7 @@ var {field}_as = new bsn.AutoSuggest('{field}', {field}_opts);
def _ReadOnlyVersion(self, formdescription): def _ReadOnlyVersion(self, formdescription):
"Generate HTML for read-only view of the form" "Generate HTML for read-only view of the form"
R = ['<table class="tf-ro">'] R = ['<table class="tf-ro">']
for (field, descr) in formdescription: for field, descr in formdescription:
R.append(self._ReadOnlyElement(field, descr)) R.append(self._ReadOnlyElement(field, descr))
R.append("</table>") R.append("</table>")
return R return R