3 messages in com.googlegroups.pylons-discussvalidate arguments like validate deco...
FromSent OnAttachments
pymonger28 Aug 2006 22:28 
Ben Bangert29 Aug 2006 10:55 
pymonger29 Aug 2006 17:05 
Subject:validate arguments like validate decorator in TurboGears
From:pymonger (pymo@gmail.com)
Date:08/28/2006 10:28:45 PM
List:com.googlegroups.pylons-discuss

Hi,

Quick question: How can I validate arguments sent through a GET (similar to the validate decorator in TurboGears)?

In my controller I have this method:

@validate(validators={"count": validators.Int()}) def getCount(self,count): return Response('<b>%d</b>' % count)

however when I navigate there with http://bogus.hostname.here:5000/ping/getCount/123 I get:

Module pingsite.controllers.ping:20 in getCount

return Response('<b>%d</b>' % count)

exceptions.TypeError: int argument required

I looked at the validate function under pylons.decorators but it looks geared to validating form data that is POSTed. I probably missed something.

Your help would be greatly appreciated.

G