Misc. template cleanup per oruga effort

This commit is contained in:
Lance Edgar 2024-04-26 11:02:22 -05:00
parent ba32422059
commit 890ec64f3c
20 changed files with 125 additions and 91 deletions

View file

@ -1043,9 +1043,17 @@ class Form(object):
if field_type:
attrs['type'] = field_type
if messages:
attrs[':message'] = '[{}]'.format(', '.join([
"'{}'".format(msg.replace("'", r"\'"))
for msg in messages]))
if len(messages) == 1:
msg = messages[0]
if msg.startswith('`') and msg.endswith('`'):
attrs[':message'] = msg
else:
attrs['message'] = msg
else:
# nb. must pass an array as JSON string
attrs[':message'] = '[{}]'.format(', '.join([
"'{}'".format(msg.replace("'", r"\'"))
for msg in messages]))
# merge anything caller provided
attrs.update(bfield_attrs)