I would like to propose that we break up the @expose decorator into two
or more separate decorators. The current implementation of @expose has
a lot of functionality in it which makes it almost impossible to use
other decorators on your controller methods without breaking things.
(The reason is @expose must be the first decorator on your method so it
can use inspect.getargspec on the controller method. And since @expose
does the dict->template/json translation, other decorators do not get a
chance to alter the dict before template/json processing.)
We can split the expose decorator into two parts - input processing and
output processing. Currently, input processing includes validators and
inputform - if we put these into their own decorator(s), then it would
allow additional decorators to get in the middle and do useful things.
@expose(template="myproject.templates.foo")
@unpack(... validators and inputform stuff here ...)
def foo(bar):
...
or maybe even:
@expose(template="myproject.templates.foo")
@validators( ... validator stuff ... )
@form( ... form stuff ... )
def foo(bar):
...
My personal preference would be the latter - decorators should do only
one thing. I would be happy to submit a patch with the necessary
changes once consensus is reached on how to divide expose up.
Sean Cazzell