Opened 18 years ago
Closed 17 years ago
#3474 closed (wontfix)
Allow regex flags to be specified in url dispatcher
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | url re verbose flags | |
Cc: | frankie@… | Triage Stage: | Design decision needed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
It would be nice if the URL dispatcher allowed REs with the re.VERBOSE flag set so that we can set out our REs using triple-quoted, commented strings containing formatting whitespace. It probably even makes sense to have it on by default, as with URLs it's pretty unlikely they'll include meaningful intentional whitespace anyway. I think it would make my RE debugging taks much easier.
Thanks.
Attachments (1)
Change History (3)
by , 18 years ago
Attachment: | regex_flags_pass_to_patterns.patch added |
---|
comment:1 by , 18 years ago
Cc: | added |
---|---|
Has patch: | set |
Keywords: | flags added |
Summary: | Allow verbose REs in url dispatcher → Allow regex flags to be specified in url dispatcher |
Triage Stage: | Unreviewed → Design decision needed |
There's my attempt. With this patterns accepts a new keyword argument, flags. This is applied against all regexp in that patterns block. Very sorry about accidentally pasting half the patch into the username box. I didn't realise.
comment:2 by , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
You get set regex flags in the regex itself (see http://docs.python.org/lib/re-syntax.html), so this isn't needed. For example, (?i)^pattern/
sets up case-insensitive matches.
Against [4485]