Opened 7 years ago

Closed 7 years ago

#12463 closed (wontfix)

user_passes_test should transfer view_func parameters to test_func

Reported by: Alexandre Garnier Owned by: nobody
Component: Uncategorized Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


In some case, the test is dependant from view_func parameters.
For example : check and the user_id parameter to allow users to edit only themselves (and not be able to edit other just by changing the user_id)

Attachments (1)

user_passes_test_decorator.diff (635 bytes) - added by Alexandre Garnier 7 years ago.
patch for that if accepted

Download all attachments as: .zip

Change History (2)

Changed 7 years ago by Alexandre Garnier

patch for that if accepted

comment:1 Changed 7 years ago by Luke Plant

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: wontfix
Status: newclosed

Hi, thanks for the suggestion. My feedback:

1) Your patch does not seem to be against trunk.

2) This would break compatibility with all code that provided a test_func which did not accept *args and **kwargs, which is the normal way to write the test_func.

3) The test could also be dependent on other things from the request, as well as *args and **kwargs. But the name of the decorator is 'user_passes_test' i.e. it checks something about the user. As such, the decorator does its job well.

So, if you want a decorator that does this, you can easily write your own, and that doesn't have any compatibility issues.

For these reasons, number 2 especially, I'm closing as WONTFIX.

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