[Django] #18494: Positional arguments not passed to view functions in included urlconfs

18 views
Skip to first unread message

Django

unread,
Jun 20, 2012, 6:13:50 PM6/20/12
to django-...@googlegroups.com
#18494: Positional arguments not passed to view functions in included urlconfs
-----------------------------+---------------------------
Reporter: rfugger | Owner: nobody
Type: Bug | Status: new
Component: Core (URLs) | Version: master
Severity: Normal | Keywords: urls, urlconf
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+---------------------------
The docs say "An included URLconf receives any captured parameters from
parent URLconfs":

https://docs.djangoproject.com/en/1.4/topics/http/urls/#captured-
parameters

But this only works currently for named arguments, not positional ones.
I've included a small project demonstrating the issue, with a runnable
test case.

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

Django

unread,
Jul 8, 2012, 6:45:46 AM7/8/12
to django-...@googlegroups.com
#18494: Positional arguments not passed to view functions in included urlconfs
-------------------------------+------------------------------------
Reporter: rfugger | Owner: nobody
Type: Bug | Status: new
Component: Core (URLs) | Version: master
Severity: Normal | Resolution:
Keywords: urls, urlconf | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by stefantalpalaru):

* cc: stefantalpalaru (added)
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
* has_patch: 0 => 1
* stage: Unreviewed => Accepted


Comment:

See the attached patch for a simple fix. I've tried to write a test for
regressiontests but gave up in the process.

--
Ticket URL: <https://code.djangoproject.com/ticket/18494#comment:1>

Django

unread,
Jul 11, 2012, 10:25:34 AM7/11/12
to django-...@googlegroups.com
#18494: Positional arguments not passed to view functions in included urlconfs
-------------------------------+------------------------------------
Reporter: rfugger | Owner: nobody
Type: Bug | Status: new
Component: Core (URLs) | Version: master
Severity: Normal | Resolution:
Keywords: urls, urlconf | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by stefantalpalaru):

Better patch that only adds the unnamed matches from the parent pattern.
I've also added a test.

--
Ticket URL: <https://code.djangoproject.com/ticket/18494#comment:2>

Django

unread,
Jul 20, 2012, 1:57:27 PM7/20/12
to django-...@googlegroups.com
#18494: Positional arguments not passed to view functions in included urlconfs
-------------------------------+------------------------------------
Reporter: rfugger | Owner: nobody
Type: Bug | Status: new
Component: Core (URLs) | Version: master
Severity: Normal | Resolution:
Keywords: urls, urlconf | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by eduardocereto):

* cc: eduardocereto@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/18494#comment:3>

Django

unread,
Jul 31, 2012, 7:30:56 PM7/31/12
to django-...@googlegroups.com
#18494: Positional arguments not passed to view functions in included urlconfs
-------------------------------+------------------------------------
Reporter: rfugger | Owner: nobody
Type: New feature | Status: closed
Component: Core (URLs) | Version: master
Severity: Normal | Resolution: wontfix
Keywords: urls, urlconf | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by SmileyChris):

* status: new => closed
* type: Bug => New feature
* resolution: => wontfix


Comment:

This is not a bug -- the docs specifically cover the current behaviour:
https://docs.djangoproject.com/en/1.4/topics/http/urls/#the-matching-
grouping-algorithm.

I can't see how we could introduce this without being backwards
incompatible (someone may be using a mix and expecting the conf to ignore
the unnamed groups).

--
Ticket URL: <https://code.djangoproject.com/ticket/18494#comment:4>

Django

unread,
Aug 1, 2012, 2:50:19 PM8/1/12
to django-...@googlegroups.com
#18494: Positional arguments not passed to view functions in included urlconfs
-------------------------------+------------------------------------
Reporter: rfugger | Owner: nobody
Type: Bug | Status: reopened
Component: Core (URLs) | Version: master
Severity: Normal | Resolution:
Keywords: urls, urlconf | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by rfugger):

* status: closed => reopened
* resolution: wontfix =>
* type: New feature => Bug


Comment:

@!SmileyChris, thanks for pointing that out. However, the documentation
at that link states that positional arguments will be passed to view
functions as long as there are no named arguments. My included project
demonstrates that this is not working properly with included urlconfs. I
have two suggestions:

1. Have positional arguments passed to views as long as there are no named
arguments, even when they were captured before included urlconfs, as per
the matching-grouping algorithm documentation at your link.

2. If this is too difficult to implement, update the documentation at:

https://docs.djangoproject.com/en/1.4/topics/http/urls/#captured-
parameters

to say that positional arguments are never passed to views when they are
captured before included urlconfs. Also update the matching-grouping
algorithm documentation to say this.

Thanks!

--
Ticket URL: <https://code.djangoproject.com/ticket/18494#comment:5>

Django

unread,
Jun 24, 2014, 8:59:54 PM6/24/14
to django-...@googlegroups.com
#18494: Positional arguments not passed to view functions in included urlconfs
-------------------------------+------------------------------------

Reporter: rfugger | Owner: nobody
Type: Bug | Status: new
Component: Core (URLs) | Version: master
Severity: Normal | Resolution:
Keywords: urls, urlconf | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timo):

* has_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/18494#comment:7>

Django

unread,
Mar 20, 2015, 3:46:19 AM3/20/15
to django-...@googlegroups.com
#18494: Positional arguments not passed to view functions in included urlconfs
-------------------------------+-------------------------------------
Reporter: rfugger | Owner: nobody
Type: Bug | Status: closed

Component: Core (URLs) | Version: master
Severity: Normal | Resolution: duplicate

Keywords: urls, urlconf | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+-------------------------------------
Changes (by bpeschier):

* status: new => closed

* resolution: => duplicate


Comment:

This is a duplicate of #12943 and was recently fixed.

--
Ticket URL: <https://code.djangoproject.com/ticket/18494#comment:8>

Reply all
Reply to author
Forward
0 new messages