With the current trunk you should be able to:

class MyDandyFields(WidgetsDeclaration):
        name = TextField(validator=X)
         age = TextField(validator=Y)

class MyForm(TableForm):
        validator = Schema(chained_validators=[C1, C2], pre_validators=[P1,  
P2])
         fields = MyDandyFields()

Of course, MyDandyFields' individual validators will be merged into a  
*copy* (so you can define more complex schemas and reuse) of the  
Schema instance attached to the Form.

The autogenerated schema should look like:

class ZZZ(Schema):
        chained_validators=[C1, C2]
        pre_validators=[P1, P2
        name = X
        age = Y

The tests for this are at:
http://trac.turbogears.org/turbogears/browser/trunk/turbogears/ 
widgets/tests/test_new_validation.py
and
http://trac.turbogears.org/turbogears/browser/trunk/turbogears/ 
widgets/tests/test_nested_widgets.py
and



Does this satisfy your request or did I miss your point?


On 10/03/2006, at 23:46, Karl Guertin wrote:

>
> On 3/10/06, Alberto Valverde <[EMAIL PROTECTED]> wrote:
>> Yep, we don't need a validator for strings, but the point is that we
>> need some way to tell generate_schema to know which fields expect
>> input.
>
> If I'm following this thread correctly (I'm honestly only skimming it)
> then you're creating a schema from a a WidgetsMeta and using that for
> validation. If you're doing this, I request that I be able to define
> the formencode pre_validators and post_validators for the form
> directly instead of having to create a different schema to do so.
>
> This would allow a much simpler way to perform cross-field checks
> (e.g. if one of these fields has a value, they all must be filled)
> than the current solution of creating and maintaining a schema by hand
> just because you want chained_validators.
>
>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears-trunk
-~----------~----~----~----~------~----~------~--~---

Reply via email to