Code

Opened 7 years ago

Closed 7 years ago

#3944 closed (duplicate)

django.core.urlresolvers.reverse_helper doesn't support full regex syntax

Reported by: forest@… Owned by: jacob
Component: Uncategorized Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

reverse_helper doesn't support the full syntax offered by the Python re module. Actually, it probably can't support everything.

(Opinion: parsing regexes is difficult and dangerous; are you sure you want to do that?)

Here is my example that failed:

account(?:/(?P<subpath>.*))?$

The current implementation does not pretend to support nested parentheses. I am slightly skeptical that this approach can deal well with the trailing ? above.

-Forest

Attachments (0)

Change History (1)

comment:1 Changed 7 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Parsing regexps is hardly dangerous. Let's keep some perspective. It is difficult and if you have a better way to do reverse matching, please post a patch.

The functionality requested here is a dupe of #2977.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.