Move rendering of a form line to the FormRender class.

pull/7/head
Ferry Boender 10 years ago
parent 3d9ca8dd40
commit 563f3cdca5
  1. 20
      src/scriptform.py

@ -693,6 +693,16 @@ class FormRender():
tpl = self.field_tpl['select'] tpl = self.field_tpl['select']
return tpl.format(name=name, select_elems=''.join(select_elems), classes=classes) return tpl.format(name=name, select_elems=''.join(select_elems), classes=classes)
def r_form_line(self, type, title, input, classes, errors):
if type == 'checkbox':
html = html_field_checkbox
else:
html = html_field
return (html.format(classes=classes,
title=title,
input=input,
errors=u', '.join(errors)))
class ScriptFormWebApp(WebAppHandler): class ScriptFormWebApp(WebAppHandler):
""" """
@ -829,14 +839,8 @@ class ScriptFormWebApp(WebAppHandler):
input = fr.r_field(field['type'], **params) input = fr.r_field(field['type'], **params)
if field['type'] != 'checkbox': return fr.r_form_line(field['type'], field['title'],
html = html_field input, params['classes'], errors)
else:
html = html_field_checkbox
return (html.format(classes=params['classes'],
title=field['title'],
input=input,
errors=u', '.join(errors)))
# Make sure the user is allowed to access this form. # Make sure the user is allowed to access this form.
form_def = form_config.get_form_def(form_name) form_def = form_config.get_form_def(form_name)

Loading…
Cancel
Save