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

---

** [tickets:#6835] @validate decorators without if_invalid or error checking 
are useless**

**Status:** code-review
**Created:** Mon Nov 04, 2013 03:31 PM UTC by Dave Brondsema
**Last Updated:** Mon Nov 04, 2013 03:31 PM UTC
**Owner:** Dave Brondsema

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.



---

Sent from sourceforge.net because allura-dev@incubator.apache.org is subscribed 
to https://sourceforge.net/p/allura/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/allura/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.

Reply via email to