2009/4/7 Diez B. Roggisch <de...@web.de>:
> I just noticed that TG2 lost the capability to pass callables as validators to
> the @validate-decorator.
>
> This is a major drawback, as it prevents the dynamic selection of forms to
> validate.
>
> I guess it's to late for TG2.0, but I'd like to implement the feature for
> TG2.1 if nobody opposes.

Hi,

I think this is a good idea. I used callables with @validate in TG1 to
generate validation schemes dynamically.

I remember that I was thinking about the possibility of passing
callables to TG2 @validate over a half a year ago (here
http://trac.turbogears.org/browser/trunk/tg/controllers.py?rev=6421#L152).
Then I decided that it would overly complicate the logic as form
objects are also callable.

Imagine that you add an 'elif callable(validation.validators)' clause
at the bottom. Inside this block you'd have to repeat all of the above
checks with the object returned after calling validation.validators():

# ...
elif callable(validation.validators):
    result = validation.validators()
    if isinstance(result, dict):
        # ...

Extract method?

-- 
Timur Izhbulatov — www.timka.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to turbogears-trunk@googlegroups.com
To unsubscribe from this group, send email to 
turbogears-trunk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to