* owner: nobody => cypreess
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/13525#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* 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>
* has_patch: 0 => 1
Comment:
https://github.com/django/django/pull/4353
--
Ticket URL: <https://code.djangoproject.com/ticket/13525#comment:9>
* needs_docs: 1 => 0
* component: Core (URLs) => Documentation
* needs_tests: 1 => 0
* type: Bug => Cleanup/optimization
--
Ticket URL: <https://code.djangoproject.com/ticket/13525#comment:10>
* stage: Accepted => Ready for checkin
Comment:
Looks good, pending some cosmetic comments.
--
Ticket URL: <https://code.djangoproject.com/ticket/13525#comment:11>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"23a5d64f40b0f4a3fbfef7427ca793cb1df1034e" 23a5d64f]:
{{{
#!CommitTicketReference repository=""
revision="23a5d64f40b0f4a3fbfef7427ca793cb1df1034e"
Fixed #13525 -- Added tests and docs for nested parameters in URL
patterns.
When reversing, only outer parameters are used if captured parameters are
nested. Added tests to check the edge cases and documentation for the
behavior with an example to avoid it.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/13525#comment:12>
Comment (by Tim Graham <timograham@…>):
In [changeset:"015a9b928af233ca036b93a4d7eecf18f15cbc2b" 015a9b9]:
{{{
#!CommitTicketReference repository=""
revision="015a9b928af233ca036b93a4d7eecf18f15cbc2b"
[1.8.x] Fixed #13525 -- Added tests and docs for nested parameters in URL
patterns.
When reversing, only outer parameters are used if captured parameters are
nested. Added tests to check the edge cases and documentation for the
behavior with an example to avoid it.
Backport of 23a5d64f40b0f4a3fbfef7427ca793cb1df1034e from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/13525#comment:13>