Opened 8 years ago

Closed 8 years ago

#26835 closed Cleanup/optimization (needsinfo)

Django's URL Regex Should Match Less

Reported by: Dave Halter Owned by: nobody
Component: Core (URLs) Version: 1.9
Severity: Normal Keywords:
Cc: davidhalter88@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

A lot of Django users URLs look like this:

r'^$'
r'^users$'

I think it is annoying for a lot of users to need to write ^ and $. In my opinion, users should always have to match the full URL. With .* anyone could easily match the old behavior.

I have often come across URLs where the ^ and $ tags have been forgotten and therefore pretty much any URL would have matched.

This is obviously something that breaks backwards compatibility, so we would have to think about possibly deprecating the old behavior.

django.conf.urls.include() would obviously not need to match everything.

I'd be glad to help out with the implementation.

Change History (2)

comment:1 by Dave Halter, 8 years ago

Cc: davidhalter88@… added

comment:2 by Tim Graham, 8 years ago

Resolution: needsinfo
Status: newclosed

Please make a proposal like this on the DevelopersMailingList. If there's consensus to move forward with it, we'll reopen the ticket.

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