Mike Orr
2009-01-22 20:24:57 UTC
FormEncode schemas seem like a good way to validate other kinds of
data besides form input, in particular a Pylons configuration from an
INI file. However, the schema format does not allow variables with
dots in their names, which is common in this situation.
I wonder if a small enhancement would alleviate this, such as treating
a double underscore in the middle of a name as a dot.
class ConfigValidator(Schema):
beaker__cache_time = Integer() # => {'beaker.cache_time': 3600}
Or the schema class could have a dict attribute of validators to merge in:
class ConfigValidator(Schema):
other_validators = {
"beaker.cache_time": Integer(),
}
data besides form input, in particular a Pylons configuration from an
INI file. However, the schema format does not allow variables with
dots in their names, which is common in this situation.
I wonder if a small enhancement would alleviate this, such as treating
a double underscore in the middle of a name as a dot.
class ConfigValidator(Schema):
beaker__cache_time = Integer() # => {'beaker.cache_time': 3600}
Or the schema class could have a dict attribute of validators to merge in:
class ConfigValidator(Schema):
other_validators = {
"beaker.cache_time": Integer(),
}
--
Mike Orr <***@gmail.com>
Mike Orr <***@gmail.com>