Easy answer. It cannot be done.

Flask and Django execute the controller (sees the decorator and
registers it) before any http request arrives. Web2py executes the
controller after the http request arrives. Morover changing it (even
if it were possible) would be a change in backward compatibility.

Difficult answer.
There may be a way... let me give it some thought, just as a proof of
concept.

On Oct 27, 10:43 am, VP <vtp2...@gmail.com> wrote:
> I saw this marriage between web2py and Flask (a strange one, I'll give
> you that)... but I'm thinking web2py might be able to improve its
> syntax/convention as follows.
>
> Here's Flask:
>
> @app.route('/insertdog/<name>/<age>/<owner>')
> def insertdog(name,owner,age):
>      # other things
>
> Here's web2py:
>
> def insertdog():
>     name, owner, age = request.args(0), request.args(1),
> request.args(2)
>     # these variables might need to be further (type)validated
>
> I think there's something not very elegant about this.  Ideally, this
> is what I want to see in web2py
>
> def insertdog(name, owner, age):
>     # request.args should be automatically assigned to these arguments
>
> Isn't this a lot nicer?   Will this be feasible?  Does it contract or
> mess up other web2py's ways of doing things?
>
> If not, can this be done?
>
> Honestly, I think this is where the money is... at least  more so than
> the cube2py, wizard thingies.  :-)

Reply via email to