Opened 8 years ago

Closed 5 years ago

#18494 closed Bug (duplicate)

Positional arguments not passed to view functions in included urlconfs

Reported by: Ryan Fugger Owned by: nobody
Component: Core (URLs) Version: master
Severity: Normal Keywords: urls, urlconf
Cc: arv@…, stefantalpalaru, eduardocereto@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The docs say "An included URLconf receives any captured parameters from parent URLconfs":

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.

Attachments (3)

project.tar.gz (3.3 KB) - added by Ryan Fugger 8 years ago.
propagate_unnamed_groups_to_included_urlconfs.patch (980 bytes) - added by stefantalpalaru 8 years ago.
the fix
propagate_unnamed_groups_to_included_urlconfs2.patch (2.6 KB) - added by stefantalpalaru 8 years ago.
better fix and test case

Download all attachments as: .zip

Change History (11)

Changed 8 years ago by Ryan Fugger

Attachment: project.tar.gz added

Changed 8 years ago by stefantalpalaru

the fix

comment:1 Changed 8 years ago by stefantalpalaru

Cc: stefantalpalaru added
Has patch: set
Triage Stage: UnreviewedAccepted

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

Changed 8 years ago by stefantalpalaru

better fix and test case

comment:2 Changed 8 years ago by stefantalpalaru

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

comment:3 Changed 8 years ago by Eduardo Cereto

Cc: eduardocereto@… added

comment:4 Changed 7 years ago by Chris Beaven

Resolution: wontfix
Status: newclosed
Type: BugNew feature

This is not a bug -- the docs specifically cover the current behaviour:

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).

comment:5 Changed 7 years ago by Ryan Fugger

Resolution: wontfix
Status: closedreopened
Type: New featureBug

@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.
  1. If this is too difficult to implement, update the documentation at:

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.


comment:6 Changed 7 years ago by Aymeric Augustin

Status: reopenednew

comment:7 Changed 6 years ago by Tim Graham

Has patch: unset

comment:8 Changed 5 years ago by Bas Peschier

Resolution: duplicate
Status: newclosed

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

Note: See TracTickets for help on using tickets.
Back to Top