

def do_field(self, indent, value, **kwargs):
    field_name = kwargs['name']
    field = getattr(self.form, field_name)
    error = field.error
    obj = self.form.fields[field_name]
    help_string = (kwargs.get('help_string', None) or field.help_string)
    if ('label' in kwargs):
        label = kwargs['label']
    else:
        label = obj.label
    if label:
        obj.label = label
        label_text = obj.get_label(_class='field')
    else:
        label_text = ''
    _class = self.get_class(obj)
    if error:
        _class = (_class + ' error')
    if self.is_hidden(obj):
        return str(field)
    div = Tag('div', _class=_class)
    with div:
        if error:
            div.strong(error, _class='message')
        if (self.get_widget_name(obj) == 'Checkbox'):
            (div << ((('<label>' + str(field)) + label) + '</label>'))
            (div << help_string)
        else:
            (div << label_text)
            (div << help_string)
            (div << field)
    return ((indent * ' ') + str(div))

dataset/ETHPy150Open limodou/uliweb/uliweb/form/template_layout.py FormWriter.do_field/original