1
###############################################################################
3
# Copyright (C) 2007-TODAY Tiny ERP Pvt Ltd. All Rights Reserved.
7
# Developed by Tiny (http://openerp.com) and Axelor (http://axelor.com).
9
# The OpenERP web client is distributed under the "OpenERP Public License".
10
# It's based on Mozilla Public License Version (MPL) 1.1 with following
13
# - All names, links and logos of Tiny, Open ERP and Axelor must be
14
# kept as in original distribution without any changes in all software
15
# screens, especially in start-up page and the software header, even if
16
# the application source code has been changed or updated or code has been
19
# - All distributions of the software must keep source code with OEPL.
21
# - All integrations to any other software must keep source code with OEPL.
23
# If you need commercial licence to remove this kind of restriction please
26
# You can see the MPL licence at: http://www.mozilla.org/MPL/MPL-1.1.html
28
###############################################################################
30
from formencode.validators import *
31
from formencode.schema import Schema
32
from formencode.foreach import ForEach
35
class BaseValidator(FancyValidator):
39
class DefaultValidator(BaseValidator):
44
"""Modified Schema validator.
46
A schema validates a dictionary of values, applying different validators
47
(by key) to the different values.
49
This modified Schema allows fields that do not appear in the fields
50
parameter of your schema, but filters them out from the value dictionary.
51
You might want to set filter_extra_fields to True when you're building a
52
dynamic form with unpredictable keys and need these values.
56
filter_extra_fields = True
57
allow_extra_fields = True
60
def from_python(self, value, state=None):
61
# The Schema shouldn't do any from_python conversion because
62
# adjust_value already takes care of that for all childs.