-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
router.add_resource(), regexps and curly braces #1778
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
Comments
I've been able to use curly brackets in regexes, though this should be clarified in the documentation |
could anyone create PR? |
Ans also, can anyone explain how route parsing is done ? regexps from sources are very complex. I can't prove that they don't have bugs. |
I don't really know, @asvetlov wrote this part. |
@asvetlov could you review this? |
Doing some research, it looks like the two examples given in the original report produce invalid route errors -- e.g. the default aiohttp router refuses to build the route map. However, a route like Edit: Looks like the the Any unmatched |
I'm inclining to forbidding curved brackets inside embedded regexps. |
I think that's a move too far, though I could be bias since I have date based routes that use the |
Maybe, we should invent some escaping? if so, any regexp can be used. |
For example, in |
Is there any good routing open source libraries? I would replace our own implementation with some good library |
I don't think there is a reason to do that for current router. It has own flaws, but afaik it was never pretended to be very fast, optimal and featured. Just the one that works in most of cases and easy to be implemented. Instead of making it more complicated and slower, may be take a look on possible alternatives? P.S. As for this issue, it seems to be possible solved by working with path segments instead of whole path and few more stringy work to decouple identifier and regexp matching. Curved brackets there are just a marker to strip and go. |
@fafhrd91 Though, not sure about good. |
I prefer c-library. |
Aiohttp supports only simple regexps and disallow to implement own router with different matching behavior. One of issue is to match for example UUID (
which could be used:
To recreate reverse url:
Example: This doesn't cover all regex possibilites, but allow to define more complex scenarios. |
I prefer keeping simple regexps only |
Well. We stated in the docs:
What if regexp contains curly braces ?
Is it correct (now, and in future) to write regexps like:
Technically speaking, they are correct regexps, but will aiohttp's resource format parser eat them?
In other words, it is not said which symbols (and how) must be escaped (from parser) in these regexps.
The text was updated successfully, but these errors were encountered: