On Thu, Jan 22, 2009 at 2:24 PM, Mike Orr <sluggoster@???> wrote:
> 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(),
> }
I'm pretty sure this works:
class ConfigValidator(Schema):
fields = {'beaker.cache_time': Integer()}
--
Ian Bicking | http://blog.ianbicking.org
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword_______________________________________________
FormEncode-discuss mailing list
FormEncode-discuss@???
https://lists.sourceforge.net/lists/listinfo/formencode-discuss