Opened 10 years ago

Closed 10 years ago

#4044 closed (fixed)

URLconf with prefix and callable views raises an exception

Reported by: wip@… Owned by: Adrian Holovaty
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@…> 10 years ago.
Fix for incorrect handling of non-string views
url_defaults.2.patch (576 bytes) - added by Vinay Sajip <vinay_sajip@…> 10 years ago.
Improved fix for incorrect handling of non-string views

Download all attachments as: .zip

Change History (5)

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

Summary: URLconf with prefix and callable views.URLconf with prefix and callable views raises an exception
Triage Stage: UnreviewedAccepted

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

Attachment: url_defaults.patch added

Fix for incorrect handling of non-string views

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

Has patch: set

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

Attachment: url_defaults.2.patch added

Improved fix for incorrect handling of non-string views

comment:3 Changed 10 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(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