Opened 8 years ago

Closed 8 years ago

#4044 closed (fixed)

URLconf with prefix and callable views raises an exception

Reported by: wip@… Owned by: adrian
Component: Core (Other) Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Despite what the documentation for the URLconf says, having a prefix and callable views results in an exception.

This line here is the reasoning for it. prefix will resolve to True, so it then checks prefix concatenated with the view instead of skipping straight to passing the view. You can't concantenate a string and a function, so an exception is thrown.

Attachments (2)

url_defaults.patch (565 bytes) - added by Vinay Sajip <vinay_sajip@…> 8 years ago.
Fix for incorrect handling of non-string views
url_defaults.2.patch (576 bytes) - added by Vinay Sajip <vinay_sajip@…> 8 years ago.
Improved fix for incorrect handling of non-string views

Download all attachments as: .zip

Change History (5)

comment:1 Changed 8 years ago by Simon G. <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from URLconf with prefix and callable views. to URLconf with prefix and callable views raises an exception
  • Triage Stage changed from Unreviewed to Accepted

Changed 8 years ago by Vinay Sajip <vinay_sajip@…>

Fix for incorrect handling of non-string views

comment:2 Changed 8 years ago by Vinay Sajip <vinay_sajip@…>

  • Has patch set

Changed 8 years ago by Vinay Sajip <vinay_sajip@…>

Improved fix for incorrect handling of non-string views

comment:3 Changed 8 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(In [5127]) Fixed #4044 -- Allowed callable views specifier to mix (i.e. not crash) with
prefix strings in URLConfs. Thanks, Vinay Sajip.

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