Opened 14 years ago

Closed 14 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: no UI/UX: no

Description

In some case, the test is dependant from view_func parameters.
For example : check user.pk 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 14 years ago.
patch for that if accepted

Download all attachments as: .zip

Change History (2)

by Alexandre Garnier, 14 years ago

patch for that if accepted

comment:1 by Luke Plant, 14 years ago

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