#13525: URL Reverser chokes on nested groups
-------------------------------+-------------------------------------
     Reporter:  nickretallack  |                    Owner:  bpeschier
         Type:  Bug            |                   Status:  assigned
    Component:  Core (URLs)    |                  Version:  1.1
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Accepted
    Has patch:  0              |      Needs documentation:  1
  Needs tests:  1              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+-------------------------------------
Changes (by bpeschier):

 * owner:  cypreess => bpeschier
 * needs_docs:  0 => 1
 * needs_tests:  0 => 1


Comment:

 This is very hard to do, since both groups are captured and (if there was
 a working implementation) should both be given to the reverser. There
 would be a hard link between both groups since the inner group would
 influence the outer group. Using an outer non-capturing group will work
 and is recommended for this use case:

 {{{
 urlpatterns = patterns('',
     url(r'^export1\.(?P<format>\w+)$', lambda request:
 HttpResponse("THIS"), name='this'),
     url(r'^export2(?:\.(?P<format>\w+))?$', lambda request:
 HttpResponse("THAT"), name='that'),
 )
 }}}

 I can update the tests and document the limitations that nested captured
 groups are not supported.

--
Ticket URL: <https://code.djangoproject.com/ticket/13525#comment:8>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.11ae79830aceb326a3a857ca455f217d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to