Opened 10 years ago

Closed 9 years ago

#3474 closed (wontfix)

Allow regex flags to be specified in url dispatcher

Reported by: admackin@… Owned by: nobody
Component: Core (Other) Version: master
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: UI/UX:

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)

regex_flags_pass_to_patterns.patch (4.1 KB) - added by frankie@… 10 years ago.
Against [4485]

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by frankie@…

Against [4485]

comment:1 Changed 10 years ago by frankie@…

Cc: frankie@… added
Has patch: set
Keywords: flags added
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Summary: Allow verbose REs in url dispatcherAllow regex flags to be specified in url dispatcher
Triage Stage: UnreviewedDesign 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 Changed 9 years ago by Jacob

Resolution: wontfix
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top