Opened 18 years ago

Closed 17 years ago

#3474 closed (wontfix)

Allow regex flags to be specified in url dispatcher

Reported by: admackin@… 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)

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

Download all attachments as: .zip

Change History (3)

by frankie@…, 18 years ago

Against [4485]

comment:1 by frankie@…, 18 years ago

Cc: frankie@… added
Has patch: set
Keywords: flags added
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 by Jacob, 17 years ago

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