Opened 9 years ago

Closed 9 years ago

#6679 closed (fixed)

decorator_from_middleware() doesn't call process_view() properly

Reported by: Marty Alchin Owned by: Gary Wilson
Component: Uncategorized Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

In django.utils.decorators.decorator_from_middleware(), the portion which calls the middleware's process_view() method does with the dynamic argument modifies * and **, even though the middleware protocol specifies that the args and kwargs values should come in as separate distinct arguments.

If this function is used to transform any middleware that implements the process_view() method into a decorator, a TypeError is raised when any view using that decorator is executed.

TypeError: process_view() got an unexpected keyword argument '...'

Attachments (1)

6679.diff (610 bytes) - added by Marty Alchin 9 years ago.
Simple fix, removing the argument modifiers so process_view() gets called the way it should

Download all attachments as: .zip

Change History (4)

Changed 9 years ago by Marty Alchin

Attachment: 6679.diff added

Simple fix, removing the argument modifiers so process_view() gets called the way it should

comment:1 Changed 9 years ago by Simon G <dev at simon dot net dot nz>

Triage Stage: UnreviewedReady for checkin

comment:2 Changed 9 years ago by Gary Wilson

Owner: changed from nobody to Gary Wilson
Status: newassigned

working on some tests...

comment:3 Changed 9 years ago by Gary Wilson

Resolution: fixed
Status: assignedclosed

(In [7269]) Fixed #6679 -- In decorator_from_middleware, don't unpack arguments when calling a middleware's
process_view method, thanks Gulopine.

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