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

Use cases of Dream.path #238

Open
amongonz opened this issue Jul 30, 2022 · 0 comments
Open

Use cases of Dream.path #238

amongonz opened this issue Jul 30, 2022 · 0 comments
Assignees
Milestone

Comments

@amongonz
Copy link

The function Dream.path has been marked as deprecated. I understand that structured routing is preferable, but its removal blocks use cases for which routes can't be computed upfront. For example:

  • Dream.static depends on the internal equivalent to path to map paths to the file system; it should be possible to implement such a handler with Dream's public API as well.
  • I'm currently writing a CGI handler, and I needed path to forward paths to CGI scripts.

If path were removed, implementing such handlers would become an exercise in recursive application of Dream.router to consume the entire path that wouldn't even provide any static information to parent scopes. Simple access to the path feels to me too foundational to remove, even if it competes with structured routes. (Would access to query parameters be removed as well if they were made routable?)

If widespead access to path is problematic for routing, maybe path could return a value only when the innermost route handler ends with a wildcard, and raise an exception otherwise. This would make handlers like static or my CGI handler fail unless mounted directly under a wildcard, which I think is reasonable.

@aantron aantron added this to the alpha6 milestone Apr 17, 2023
@aantron aantron self-assigned this Apr 26, 2023
aantron added a commit that referenced this issue May 11, 2023
Path getter and setter not removed. See #238. not_found just deprecated,
so not removed, for users to have more of a chance to adapt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants