Beispiel #1
0
 def __init__(self, name, fields, validators=[], **kwargs):
     self.validators = validators
     self.fields = fields + [Hidden('__csrf_token')]
     kwargs.setdefault('method', 'POST')
     kwargs.setdefault('action', '')
     kwargs.setdefault('errors_class', 'form_errors')
     kwargs.setdefault('error_class', 'form_error')
     InputBase.__init__(self, name, **kwargs)
Beispiel #2
0
def load():
    if conf.model_type == 'ff':
        from input_base import InputBase
        input = InputBase()
    else:
        from input_cnn import InputCNN
        input = InputCNN()
    input.load(conf.path)
    return input
Beispiel #3
0
    def __init__(self, name, label=None, validator=None, **kwargs):
        if self.__template__ is None:
            assert self.__input_type__ is not None
            self.__class__.__template__ =  """
<html
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:py="http://genshi.edgewall.org/"
    py:strip="">
<div class="$row_class">
    <label py:if="has_label" for="$name">$label</label>
    <%(input_tag)s name="$name" type="%(input_type)s" value="$value" />
    <div py:if="error" class="$error_class">$error</div>
</div>
</html>
            """ % {
                'input_type': self.__input_type__,
                'input_tag': self.__input_tag__,
            }
        kwargs.setdefault('label', name)
        kwargs.setdefault('has_label', self.__has_label__)
        kwargs.setdefault('row_class', 'form_row')
        kwargs.setdefault('error_class', 'form_error')
        self.validator = validator
        InputBase.__init__(self, name, **kwargs)