def apply_param_schema(self):
        '''Applies the schema defined to the given parameters.

        This combines the values in ``config_params`` and
        ``query_params``, and converts them to typed Python values per
        ``param_schema``.

        This is called automatically whenever the query parameters are
        updated.
        '''
        def param_str(name, cons, default):
            try:
                v = self.query_params.get(name, default)
                if v is None:
                    return v
                if len(v) == 0:
                    return default
                return cons(v)
            except (__HOLE__, ValueError):
                return default

        def param_num(name, cons, default, minimum, maximum):
            try:
                n = cons(self.query_params.get(name, default))
                return min(maximum, max(minimum, n))
            except (TypeError, ValueError):
                return default

        for name, schema in getattr(self, 'param_schema', {}).iteritems():
            default = self.config_params.get(name, schema.get('default', None))
            v = None
            if schema['type'] == 'bool':
                v = param_str(name, lambda s: bool(int(s)), False)
            elif schema['type'] == 'int':
                v = param_num(
                    name, int, default=default,
                    minimum=schema.get('min', 0),
                    maximum=schema.get('max', 1000000))
            elif schema['type'] == 'float':
                v = param_num(
                    name, float, default=default,
                    minimum=schema.get('min', 0),
                    maximum=schema.get('max', 1000000))
            elif schema['type'] is 'bytes':
                v = param_str(name, schema.get('cons', str), default)
            elif schema['type'] is 'unicode':
                encoding = schema.get('encoding', 'utf-8')
                v = param_str(name, lambda s: s.decode(encoding), default)
            self.params[name] = v
dataset/ETHPy150Open dossier/dossier.web/dossier/web/interface.py/Queryable.apply_param_schema