

def do_field(self, indent, value, **kwargs):
    field_name = kwargs.pop('name')
    field = getattr(self.form, field_name)
    error = field.error
    obj = self.form.fields[field_name]
    help_string = (kwargs.pop('help_string', None) or field.help_string)
    if ('label' in kwargs):
        label = kwargs.pop('label')
    else:
        label = obj.label
    if label:
        obj.label = label
        label_text = obj.get_label(_class='control-label')
    else:
        label_text = ''
    _class = (self.get_class(obj) + ' control-group')
    if (label_text == ''):
        _class = (_class + ' nolabel')
    if error:
        _class = (_class + ' error')
    field.field.html_attrs.update(kwargs)
    if self.is_hidden(obj):
        return str(field)
    div_group = Tag('div', _class=_class, id=('div_' + obj.id))
    with div_group:
        if (self.get_widget_name(obj) == 'Checkbox'):
            (div_group << '')
        else:
            (div_group << label_text)
        div = Tag('div', _class='controls')
        with div:
            if (self.get_widget_name(obj) == 'Checkbox'):
                (div << ((('<label>' + str(field)) + label) + '</label>'))
            else:
                (div << field)
            (div << Tag('div', _class='help help-block', _value=help_string))
            if error:
                (div << Tag('div', _class='message help-block', _value=error))
        (div_group << str(div))
    return ((indent * ' ') + str(div_group))

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