#6835 @validate decorators without if_invalid or error checking are useless

v1.1.0
closed
sf-1 (616)
General
2015-08-20
2013-11-04
No

A URL like this /p/.../discussion/general/?limit=1&page=2x generates this error:

 Module forgediscussion.controllers.forum:102 in index         view
>>  limit, page, start = g.handle_paging(limit, page)
Module allura.lib.app_globals:359 in handle_paging         view
>>  page = max(int(page), 0)
ValueError: invalid literal for int() with base 10: '2x'

despite having @validate(dict(page=validators.Int(if_empty=0), on the controller, because all that @validate does is determine if there are errors and sets them up on the template context for the controller/template to handle. On form submissions, the form is normally set up to show error messages, but if that's not set up nothing happens - e.g. handling GET url parameters.

We should have if_invalid=0 on the validator.

Discussion

  • Dave Brondsema

    Dave Brondsema - 2013-11-04
    • status: open --> code-review
    • assigned_to: Dave Brondsema
     
  • Dave Brondsema

    Dave Brondsema - 2013-11-04

    allura:db/6835 and forge-classic:db/6835

     
    • QA: Tim Van Steenburgh
     
    • status: code-review --> closed
     

Log in to post a comment.