Django

Code

Ticket #6934 (closed: fixed)

Opened 7 months ago

Last modified 1 month ago

django.core.urlresolvers.reverse fails sometimes.

Reported by: sebastian_noack Assigned to: mtredinnick
Milestone: Component: Core framework
Version: SVN Keywords:
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 1

Description (Last modified by mtredinnick)

If you have a url pattern, containing...

- nested groups - not-matching groups - look-ahead or look-behind groups

...django.core.urlresolvers.reverse will fail, because of following reasons:

- To replace the groups re.sub with r'\(([^)]+)\)' is used, which matches only until the first ')', doesn't matter how much groups are nested. - All groups which are no named groups are assumed to be positional groups, regardless if they might be not-matching, look-ahead or look-behind groups.

Attachments

support-for-more-flexible-url-regex-patterns.patch (2.6 kB) - added by sebastian_noack on 04/01/08 08:11:51.

Change History

04/01/08 08:11:51 changed by sebastian_noack

  • attachment support-for-more-flexible-url-regex-patterns.patch added.

04/02/08 00:12:52 changed by mtredinnick

  • description changed.
  • needs_better_patch set to 1.
  • needs_tests changed.
  • summary changed from [PATCH] django.core.urlresolvers.reverse fails sometimes. to django.core.urlresolvers.reverse fails sometimes..
  • owner changed from nobody to mtredinnick.
  • needs_docs changed.
  • stage changed from Unreviewed to Accepted.

This is a dupe of #2977, amongst others. But I'll leave it open because the patch is an interesting approach. I really need to finish fixing this, so maybe this will get me motivated.

04/04/08 03:50:53 changed by sebastian_noack

  • component changed from HTTP handling to Core framework.

05/05/08 11:22:57 changed by sebastian_noack

This ticked is open and tagged as "Patch needs improvement" now over a month. Please can you tell me, what you don't like about my patch. So I can an acceptable patch for you. Thanks.

08/31/08 06:11:20 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(In [8760]) A rewrite of the reverse URL parsing: the reverse() call and the "url" template tag.

This is fully backwards compatible, but it fixes a bunch of little bugs. Thanks to SmileyChris? and Ilya Semenov for some early patches in this area that were incorporated into this change.

Fixed #2977, #4915, #6934, #7206.


Add/Change #6934 (django.core.urlresolvers.reverse fails sometimes.)




Change Properties
Action