#2356: @validate decorator does not work if error_handler is not set.
------------------------+---------------------------------------------------
 Reporter:  vjaaskel    |       Owner:     
     Type:  defect      |      Status:  new
 Priority:  normal      |   Milestone:     
Component:  TurboGears  |     Version:  2.0
 Severity:  major       |    Keywords:     
------------------------+---------------------------------------------------
 It seems that the @validate decorator doesn't do any validation if the
 error_handler action is not set. A simple test case can be reproduced by
 adding the following actions to the TG2 quick start root controller:

 {{{
     @expose()
     def ok(self):
         flash('Validation passed.')
         redirect('/index')

     @expose()
     def fail(self, **kw):
         flash('Validation failed.', 'error')
         redirect('/index')

     @expose()
     # @validate(validators=dict(foo=validators.NotEmpty()),
 error_handler=fail) # Works as expected
     @validate(validators=dict(foo=validators.NotEmpty())) # doesn't work
     def test_validation(self, foo=None):
         redirect('/ok')
 }}}

 The test_validation can now be called with 'foo' empty or not set, and
 still get redirected to the /ok page. With more complex validators, an
 invalid value can be set to urlargs, POST or GET variables and still pass
 validation.

 If the error_handler is set, validation works as expected.

 Tested with tg.devtools 2.0.2

-- 
Ticket URL: <http://trac.turbogears.org/ticket/2356>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to