Hi Simon,

Thanks for the patch! This is looking pretty good and flexible.

I do have an issue:

http://trac.turbogears.org/turbogears/ticket/258

I like the idea, except for one thing: the common idiom for dealing
with form validation errors with turbogears widgets is this:

@expose(html="...")
def index(self):
    ...

@expose(html="...")
@validators(form=myform)
def save(self, val1, val2):
    if cherrypy.request.form_errors:
        return index()

Note that index doesn't have an errors parameter. An earlier version
of the TurboGears code would introspect the function to see if it had
an errors parameter, and pass the errors in if it does. Maybe we
should do that?

There's a trick there, of course. We now have 4 decorators:

expose validate error_handler identity.require

In order to introspect the function, we need direct access to it. I
think the TurboGears decorators should all set an attribute on the
function that has the original function object. That way, the
decorators are a bit more flexible in terms of how they are arranged
over the method in question.

Opinions?

Kevin

Reply via email to