Opened 18 years ago
Closed 18 years ago
#3944 closed (duplicate)
django.core.urlresolvers.reverse_helper doesn't support full regex syntax
Reported by: | Owned by: | Jacob | |
---|---|---|---|
Component: | Uncategorized | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
reverse_helper doesn't support the full syntax offered by the Python re module. Actually, it probably can't support everything.
(Opinion: parsing regexes is difficult and dangerous; are you sure you want to do that?)
Here is my example that failed:
account(?:/(?P<subpath>.*))?$
The current implementation does not pretend to support nested parentheses. I am slightly skeptical that this approach can deal well with the trailing ? above.
-Forest
Note:
See TracTickets
for help on using tickets.
Parsing regexps is hardly dangerous. Let's keep some perspective. It is difficult and if you have a better way to do reverse matching, please post a patch.
The functionality requested here is a dupe of #2977.