Exemplo n.º 1
0
def get_input(element):
    element = g(element.xpath('.//td/input'))
    _a = lambda x: element.attrib.get(x)
    attrs = ['id', 'name', 'value', 'data-id']
    field = dict([(k, _a(k)) for k in attrs])
    if 'data-dependencies' in element.attrib:
        dependencies = _a('data-dependencies').split(';')
    else:
        dependencies = None
    field['data-dependencies'] = dependencies
    field['type'] = 'radio'
    return field
Exemplo n.º 2
0
def get_inputtext(section):
    inputtext = g(section.xpath('.//input[@type="text"]'))
    _a = lambda x: inputtext.attrib.get(x)
    attrs = ['id', 'name', 'data-id', 'value']
    field = dict([(k, _a(k)) for k in attrs])
    if 'data-dependencies' in inputtext.attrib:
        dependencies = _a('data-dependencies').split(';')
    else:
        dependencies = None
    field['data-dependencies'] = dependencies
    field['type'] = 'inputtext'
    return field
Exemplo n.º 3
0
def get_textarea(section):
    textarea = g(section.xpath('.//textarea'))
    _a = lambda x: textarea.attrib.get(x)
    attrs = ['id', 'name', 'data-id', 'value']
    field = dict([(k, _a(k)) for k in attrs])
    if 'data-dependencies' in textarea.attrib:
        dependencies = _a('data-dependencies').split(';')
    else:
        dependencies = None
    field['data-dependencies'] = dependencies
    field['type'] = 'textarea'
    return field
Exemplo n.º 4
0
def get_field(section):
    select = g(section.xpath('.//select'))
    _a = lambda x: select.attrib.get(x)
    attrs = ['id', 'data-id', 'name']
    field = dict([(k, _a(k)) for k in attrs])
    return field