Re: validating through decorators?

"Mike Orr" <[email protected]> Mon, 25 Aug 2008 02:34:14 -0700
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
On Mon, Aug 25, 2008 at 1:48 AM, Luca Lesinigo <[email protected]> wrote:
> Hello there.
> I discovered validation and FormEncode while playing with TurboGears. Now
> I'm working on a little project of my own without TurboGears and I'd like to
> validate user-entered input (direct calls to my module or command line
> arguments, no web here) so I obviously turned to FormEncode.
> I'd like to validate data with decorators in front of my module methods,
> since it's so easy and elegant, but as far as I can understand the @validate
> decorator was part of TG and there's nothing like that in FE?
> So the standard way to use validators with FE alone would be to call them
> from inside my methods?
> I looked and searched through the documentation on the website but couldn't
> find anything, and any other search though google always gives links to TG
> or other web frameworks...

FormEncode is too low level to have an @validate decorator.  The right
way to build it depends on the framework or application.  Pylons has
an @validate decorator but it has proven too monolithic for many
cases, so we're looking at splitting it up into three parts.  This
illustrates the general problem of what should a @validate decorator
do, and that it's application-dependant.

-- 
Mike Orr <[email protected]>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/