I've posted a new version here: http://trac.turbogears.org/turbogears/attachment/ticket/696/fix-for-696-take2.patch
I moved the logic from SelectionField to the SelectionValidator, we have to use if_key_missing = '' otherwise the Schema will not call the validator and finally cleaned up the way is_named works. All tests are running fine just one needed a really small correction since it was (wrongly now) trying to validate a value for a normal submit button. ;-) Ciao Michele Michele Cella wrote: > Kevin Dangoor wrote: > > > > Why do you need is_named = True? Can you just say "if widget.name"? > > > > This will work if we default to widget.name = None that IMHO makes more > sense than widget.name = "widget" and is more natural. > > We will need to remove name = ... from some form field and check that > nothing strange happens with the Schema generation... > > In the meanwhile I've attached a first attempt for #696: > > http://trac.turbogears.org/turbogears/attachment/ticket/696/fix-for-696.patch > > Any comment is very welcome, particularly on two things: > > - I introduced a custom validator for SelectionField that returns a > plain error message (not a list as ForEach does) and not something like > "Please enter an integer value". > > - There is a small hack needed at Selection field so that if the > selection is not required (the default) you will not receive a list > like [""] but an empty list [], this IMHO should be moved to > SelectionValidator > > - I don't think FE provides something like the SelectionValidator I > used > > Ciao > Michele --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
