I thought I knew, and then I was looking at the parameter descriptions for http://flask.pocoo.org/docs/api/#flask.Flask.route. From this I gather: The URL associated with the view function is not the endpoint (the first parameter). The view function called when the URL is accessed is not the endpoint (the third parameter). So... what's an endpoint (the second parameter)? When I started reading the documentation yesterday, I assumed the endpoint and URL were synonymous. Thanks! (And by the way, totally loving Flask so far, awesome job :) - Mike
@app.route('/user/<name>', endpoint='user'):
def view_user(name):
pass
@app.route('/user/new', endpoint='user'):
def new_user():
pass
url_for('user') will yield url for new_user
url_for('user', name='krace') will yield url for view_user
This approach falls short when no of dynamic parts are same.
On Sat, Oct 13, 2012 at 11:46 PM, Michael Parker <michael.g.parker@gmail.com
> wrote:
> I thought I knew, and then I was looking at the parameter descriptions
> for http://flask.pocoo.org/docs/api/#flask.Flask.route. From this I
> gather:
>
> The URL associated with the view function is not the endpoint (the
> first parameter).
> The view function called when the URL is accessed is not the endpoint
> (the third parameter).
>
> So... what's an endpoint (the second parameter)? When I started
> reading the documentation yesterday, I assumed the endpoint and URL
> were synonymous.
>
> Thanks! (And by the way, totally loving Flask so far, awesome job :)
>
> - Mike
>
--
*
Thanks & Regards
"Talk is cheap, show me the code" -- Linus Torvalds
kracekumar
class=sig>www.kracekumar.com
*
That clarifies things. Thanks for the prompt and informative response! - Mike On Sat, Oct 13, 2012 at 11:23 AM, kracekumar ramaraju <kracethekingmaker@gmail.com> wrote: > @app.route('/user/<name>', endpoint='user'): > def view_user(name): > pass > > @app.route('/user/new', endpoint='user'): > def new_user(): > pass > > > url_for('user') will yield url for new_user > url_for('user', name='krace') will yield url for view_user > > This approach falls short when no of dynamic parts are same. > > > On Sat, Oct 13, 2012 at 11:46 PM, Michael Parker > <michael.g.parker@gmail.com> wrote: >> >> I thought I knew, and then I was looking at the parameter descriptions >> for http://flask.pocoo.org/docs/api/#flask.Flask.route. From this I >> gather: >> >> The URL associated with the view function is not the endpoint (the >> first parameter). >> The view function called when the URL is accessed is not the endpoint >> (the third parameter). >> >> So... what's an endpoint (the second parameter)? When I started >> reading the documentation yesterday, I assumed the endpoint and URL >> were synonymous. >> >> Thanks! (And by the way, totally loving Flask so far, awesome job :) >> >> - Mike > > > > > -- > Thanks & Regards > > "Talk is cheap, show me the code" -- Linus Torvalds > kracekumar > www.kracekumar.com >