-
Notifications
You must be signed in to change notification settings - Fork 120
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
resource/Site: Add regular expression support for path names #38
base: master
Are you sure you want to change the base?
Conversation
Why is this pull request never reviewed? This seems to be a very useful feature. Flask has a similar feature to support variable components in an url: http://flask.pocoo.org/docs/1.0/api/#url-route-registrations . From the information I have there is no such way to describe an variable item in a resource path. Consider a resource |
I guess there should be a route/path oriented site instead of a resource based site. The werkzeug routing module could be reused: http://werkzeug.pocoo.org/docs/0.14/routing/ . |
FYI: I made a similar example using werkzeug. I use url mapping/rules to link an uri/url to a resource. This allows me to define paths, usings werkzeugs Converters, to variable resources. Without the need to define each resource in the site. The existence of a resource is checked by the render method of a resource. If a resource doesn't exists the resource must return a http://werkzeug.pocoo.org/docs/0.14/routing/ explains how werkzeugs url routing works. It's also used in flask. werkzeug is pretty decent framework. I made an path based variant on the original site by implementing the same interfaces. It's less code because a bit of the work is done by werkzeug. I'm having to will to make a pull request if there are people interested in this.
|
This PR adds an option to specify path components as regular expressions to handle dynamic sub resources without having to register each instance individually.
The example server has been updated with some new resources to demonstrate the added functionality.
Below are some example requests: