On Mar 11, 2006, at 7:54 PM, Michele Cella wrote:
> > Michele Cella wrote: >> >>> >>> I'd like someone to comment on the SubmitButton thing... I'm not >>> entirely sure but I think the test is deprecated. Apart from that, I >>> think 2 is ready for the trunk... >>> >> >> Trac down... :-( >> >> That's unfortunate... anyway what's the difference between the >> NullValidator and the StringValidator? >> >> Ciao >> Michele > > Trac up now... > > 1) The submit test is not deprecated is a wanted behavior, we don't > need the submit value in input unless stated otherwise by naming that > widget: > > http://trac.turbogears.org/turbogears/ticket/358 > > 2) I was under the impression we could do this easily by using > something like this in the Widget base class: > > def __init__(...): > if not validator: > self.validator = NullValidator() / StringValidator() > > this way we easily do that for buttons: > > def __init__(...): > super() > self.validator = None > > this way we don't need the can_add_field thing I think, am I wrong? > > Ciao > Michele mmm, looks like a good idea.. I'll try and update patch, however, can_add_field is needed because it's there to make sure that if you set a custom schema in a FieldsContainer it's fields prevail over the widget's own... gee, better code it: class MySchema(Schema): age = Int() class Fields(WD): age = TextField(validator=String()) form = Form(fields=Fields(), validator=MySchema()) Then "age" will be validated by Int(), not String() I think that this is important because it let's you reuse schemas more consistently (don't worrying about the validators on the widgets you're validating) Now slightly off-topic, shouldn't the template_var "attrs" belong to FormField instead of repeating it at almost every FormField? Adeu, Alberto > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
