Opened 9 years ago

Last modified 8 years ago

#26621 closed Bug

simplify_regex handles named capture groups incorrectly — at Version 1

Reported by: Alex Rothberg Owned by: nobody
Component: contrib.admindocs Version: 1.9
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

For example using a regex from Django Rest Framework docs:

>>> from django.contrib.admindocs.views import simplify_regex
>>> simplify_regex(r'^(?P<version>(v1|v2))/bookings/(?P<pk>[0-9]+)/$')
'/<version>)/bookings/<pk>/'

The closing parenthesis in the output is unexpected.

Escaping the / does not seem to help.

Change History (1)

comment:1 by Tim Graham, 9 years ago

Component: Uncategorizedcontrib.admindocs
Description: modified (diff)
Summary: simplify_regex having problems with named capture groupssimplify_regex handles named capture groups incorrectly
Triage Stage: UnreviewedAccepted
Type: UncategorizedBug
Note: See TracTickets for help on using tickets.
Back to Top