Flask: Proposal: Rename `endpoint` to `routename`

Created on 13 Aug 2018  路  2Comments  路  Source: pallets/flask

Expected Behavior

flask.url_for(endpoint, **values) prototype should be intuitively understood by general public. That could be done if Flask doesn't redefine common understanding of endpoint its own abstraction.

The common understanding is that endpoint is an URL.

If Flask uses routename instead of endpoint, then documentation could make sense for people not aware with Flask specifics. I mean this is not normal - https://stackoverflow.com/questions/19261833/what-is-an-endpoint-in-flask - 77 votes, 52 favorites (means people need to get back to it), 176 upvotes (about 99 people who maybe thought they know what endpoint is, but maybe was confused about real meaning or function).

Alternative text.

 flask.url_for(routename, **values)

    Generates a URL for the given `routename` with URL arguments converted from `values`.

    `values` that are missing from route declaration are appended to the generated URL as query 
arguments. If the value of a query argument is None, the whole pair is skipped. In case blueprints are 
active you can shortcut references to the same blueprint by prefixing the local endpoint with a dot (.).

    This will reference the index function local to the current blueprint:

    url_for('.index')

    For more information, head over to the Quickstart.

    To integrate applications, Flask has a hook to intercept URL build errors through 
Flask.url_build_error_handlers. The url_for function results in a BuildError when the current app does 
not have a URL for the given routename and values.
...

Actual Behavior

http://flask.pocoo.org/docs/1.0/api/#flask.url_for

Environment

  • Flask version: 1.0.2

Most helpful comment

Thanks for thinking about this. At this time I'm not willing to make a change like this. "Endpoint" is not a standardized term, despite the two things you linked to. I don't even think Flask's use of the word contradicts those links, it's just a term at a different layer than what they're talking about.

I'm not sure what's not normal about that SO question, it seems fine that people were interested in how things worked and upvoted that. It's difficult to use an SO question to justify this, as it disregards the majority of people who have not interacted with it and were not confused to begin with. Given that the docs have used the term for 8+ years, I don't see a pressing need for this.

All 2 comments

Thanks for thinking about this. At this time I'm not willing to make a change like this. "Endpoint" is not a standardized term, despite the two things you linked to. I don't even think Flask's use of the word contradicts those links, it's just a term at a different layer than what they're talking about.

I'm not sure what's not normal about that SO question, it seems fine that people were interested in how things worked and upvoted that. It's difficult to use an SO question to justify this, as it disregards the majority of people who have not interacted with it and were not confused to begin with. Given that the docs have used the term for 8+ years, I don't see a pressing need for this.

Fair enough. I didn't expect any other answer, and this one is good enough. Still had to fill this issue for future reference.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maangulo12 picture maangulo12  路  4Comments

westonplatter picture westonplatter  路  3Comments

stillesjo picture stillesjo  路  4Comments

greyli picture greyli  路  3Comments

chuanconggao picture chuanconggao  路  4Comments