Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing slash handling not implemented #45

Open
waywardmonkeys opened this issue May 7, 2014 · 2 comments
Open

Trailing slash handling not implemented #45

waywardmonkeys opened this issue May 7, 2014 · 2 comments

Comments

@waywardmonkeys
Copy link
Member

None of this section from the docs is actually implemented ...

  • There seems to be fairly broad agreement that having distinct
    meanings for /foo and /foo/ is a Bad Thing, which makes sense
    since it would be difficult for a user to predict the difference.
    However, it is often useful to ensure that they both map to the same
    resource rather than having one work and the other get a 404 error.

    add-resource accepts a slash: keyword argument. When true (the
    default), add-resource will automatically map the child resource
    to both the given URL prefix and to the same URL with a trailing
    slash added. That is,

       add-resource(parent, "foo/bar", child)

    will map child to both foo/bar and foo/bar/. To change this
    behavior pass the slash: keyword argument:

    slash: #"canonical"
    Make the trailing slash URL prefix canonical (by redirecting the
    one without the trailing slash). Think "slash is canonical".

    slash: #"copy"
    Map the given resource to both the given URL and the URL with
    the trailing slash. Think "slash is a copy".

    slash: #"redirect" (the default)
    Redirect the trailing slash version of the URL to the one with
    no trailing slash. Think "slash is redirected".

    slash: #f
    Don't map the trailing slash URL prefix to any resource. Use
    this carefully since it can cause confusing results for users.

@cgay cgay changed the title slash handling functionality not implemented Trailing slash handling not implemented Sep 8, 2014
@cgay
Copy link
Member

cgay commented Sep 8, 2014

So do you think this behavior would be worth having? I guess I removed it at some point when I rewrote the routing code. I think it would be trivial for users to do themselves with a small helper function so I'm inclined to just remove the doc and close this bug.

@waywardmonkeys
Copy link
Member Author

I think it should be better than it is now... I will look at what Flask or ithers do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants