[TurboGears] Re: validation_error is going away right?
JW, That is in SVN now - if your method has a has_errors var it will get called instead of validate_error. Sean Cazzell On Thu, 2005-11-17 at 17:02 +, [EMAIL PROTECTED] wrote: I read in a post that validation_error was going away. Kevin said, That's a good point. If we deprecate validation_error, then the method can just be called directly and you can check form_errors to see if there's a problem. I think this also means that an invalid exception would never be raised. It simplifies the code, but it does also eliminate a visual reminder to check for errors. Maybe that's not so bad, though. The idea being that the method being called would receive a has_errors argument. The example Kevin gave is below: @turbogears.expose(input_form=myform) def save(self, name, address, age, has_errors): if has_errors: return self.index() Did this change ever make it into turbo-gears? I've been playing with validators and have really grown to not like the validation_error method of dealing with problems :). I'd really like to know what the new-method will be, if there is going to be one. Thanks, jw
[TurboGears] Re: validation_error is going away right?
It was also noted earlier that has_errors may actually be redundant and can be eliminated in favor of just setting the errors on the request object. Kevin On 11/17/05, Sean Cazzell [EMAIL PROTECTED] wrote: JW, That is in SVN now - if your method has a has_errors var it will get called instead of validate_error. Sean Cazzell On Thu, 2005-11-17 at 17:02 +, [EMAIL PROTECTED] wrote: I read in a post that validation_error was going away. Kevin said, That's a good point. If we deprecate validation_error, then the method can just be called directly and you can check form_errors to see if there's a problem. I think this also means that an invalid exception would never be raised. It simplifies the code, but it does also eliminate a visual reminder to check for errors. Maybe that's not so bad, though. The idea being that the method being called would receive a has_errors argument. The example Kevin gave is below: @turbogears.expose(input_form=myform) def save(self, name, address, age, has_errors): if has_errors: return self.index() Did this change ever make it into turbo-gears? I've been playing with validators and have really grown to not like the validation_error method of dealing with problems :). I'd really like to know what the new-method will be, if there is going to be one. Thanks, jw -- Kevin Dangoor Author of the Zesty News RSS newsreader email: [EMAIL PROTECTED] company: http://www.BlazingThings.com blog: http://www.BlueSkyOnMars.com
[TurboGears] Re: validation_error is going away right?
The has_errors variable is used as a flag. If you remove it, then I assume that turbogears.expose would get some kw argument telling it to not call validate_error? Thanks for the replies, y'all. I assume that this feature is not concrete yet, that is it is subject to change. jw
[TurboGears] Re: validation_error is going away right?
Here's my thinking, if a validation error comes up: - save the errors in the request - if there's a validation_error method, call that with a DeprecationWarning - otherwise just call the original method, which can check for the presence of errors Kevin On 11/17/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: The has_errors variable is used as a flag. If you remove it, then I assume that turbogears.expose would get some kw argument telling it to not call validate_error? Thanks for the replies, y'all. I assume that this feature is not concrete yet, that is it is subject to change. jw -- Kevin Dangoor Author of the Zesty News RSS newsreader email: [EMAIL PROTECTED] company: http://www.BlazingThings.com blog: http://www.BlueSkyOnMars.com