decorating validators, CompoundValidator

"W-Mark Kubacki" <wmark-/[email protected]> Tue, 20 May 2008 16:48:04 +0200
Newsgroups gmane.comp.python.formencode
Message-ID <!&!AAAAAAAAAAAYAAAAAAAAAItLYclRiTNErRhDCQ03QLwigQAAEAAAANDpDNZRgEhColRjZBcB/[email protected]>
Hi group,
hello Ian,

Can we introduce a Consecutive/Stepper/Decorating validator or reanimate the 
CompoundValidator, so the developer can combine decorators?
    email = Decorating(String(), Email())
This could basically act like All but the output of the left validator is 
handled over to its right neighbor. (And vice versa, in case of from_python())
    # value is the input
    # op in ['to_python', 'from_python']
    # I will leave out reversion of decorated_validators for the latter.
    for validator in decorated_validators:
        value = getattr(validator, op)(value)
    return value

What do you think? Is there a more efficient way?

-- Mark

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
FormEncode-discuss mailing list
FormEncode-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/formencode-discuss
smime.p7s (application/x-pkcs7-signature, 4.3 KB) - not displayed