Exemple #1
0
    def __init__(self, **attrs):

        super(M2O, self).__init__(**attrs)
        self.relation = attrs.get('relation', '')

        self.domain = attrs.get('domain', [])
        self.context = attrs.get('context', {})
        self.link = attrs.get('link')
        self.onchange = None # override onchange in js code

        self.validator = validators.many2one()
Exemple #2
0
    'date': lambda *a: validators.DateTime(kind="date"),
    'time': lambda *a: validators.DateTime(kind="time"),
    'datetime': lambda *a: validators.DateTime(kind="datetime"),
    'float_time': lambda *a: validators.FloatTime(),
    'float': lambda *a: validators.Float(),
    'integer': lambda *a: validators.Int(),
    'selection': lambda *a: validators.Selection(),
    'char': lambda *a: validators.String(),
    'boolean': lambda *a: validators.Bool(),
    'reference': lambda *a: validators.Reference(),
    'binary': lambda *a: validators.Binary(),
    'text': lambda *a: validators.String(),
    'text_tag': lambda *a: validators.String(),
    'many2many': lambda *a: validators.many2many(),
    'one2many': lambda *a: validators.one2many(),
    'many2one': lambda *a: validators.many2one(),
    'email' : lambda *a: validators.Email(),
    'url' : lambda *a: validators.URL(),
    'picture': lambda *a: validators.Binary(),
}

class TinyFormError(formencode.api.Invalid):
    def __init__(self, field, msg, value):
        formencode.api.Invalid.__init__(self, msg, value, state=None, error_list=None, error_dict=None)
        self.field = field

class TinyForm(object):
    """An utility class to convert:

        1. local form data to the server data (throws exception if any)
        2. server data to the local data
Exemple #3
0
    "date": lambda *a: validators.DateTime(kind="date"),
    "time": lambda *a: validators.DateTime(kind="time"),
    "datetime": lambda *a: validators.DateTime(kind="datetime"),
    "float_time": lambda *a: validators.FloatTime(),
    "float": lambda *a: validators.Float(),
    "integer": lambda *a: validators.Int(),
    "selection": lambda *a: validators.Selection(),
    "char": lambda *a: validators.String(),
    "boolean": lambda *a: validators.Bool(),
    "reference": lambda *a: validators.Reference(),
    "binary": lambda *a: validators.Binary(),
    "text": lambda *a: validators.String(),
    "text_tag": lambda *a: validators.String(),
    "many2many": lambda *a: validators.many2many(),
    "one2many": lambda *a: validators.one2many(),
    "many2one": lambda *a: validators.many2one(),
    "email": lambda *a: validators.Email(),
    "url": lambda *a: validators.URL(),
    "picture": lambda *a: validators.Binary(),
}


class TinyFormError(formencode.api.Invalid):
    def __init__(self, field, msg, value):
        formencode.api.Invalid.__init__(self, msg, value, state=None, error_list=None, error_dict=None)
        self.field = field


class TinyForm(object):
    """An utility class to convert: