Incorrect Pluggable Views documentation? #592

Closed
Chris2048 opened this Issue Sep 8, 2012 · 3 comments

Projects

None yet

3 participants

@Chris2048

The 'Pluggable Views' documentation includes the line

app.add_url_rule('/users/', ShowUsers.as_view('show_users'))

but isn't the second parameter to add_url_rule the 'name', and the third parameter the view_func?

@boris317

That example is correct. endpoint and view_func are kw arguments. If the endpoint is not given it is assumed to be the name of the view function. Here is the documentation for URL Route Registration

@Chris2048

But looking in app.py for flask 0.9 the line reads

def add_url_rule(self, rule, endpoint=None, view_func=None, **options)

So isn't 'view_func' the 3rd (or 4th if you count self) argument?
Since it isn't being passed as a kw arg in the example, then won't it be assumed to be 'endpoint'?

@boris317

Oh I am sorry, you are absolutely correct. /me Runs off to scrutinize the code further. That would also make the example at the very bottom of the URL Route Registration incorrect as well

app.add_url_rule('/', index)
@mitsuhiko mitsuhiko closed this Oct 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment