flake8
-
djblets/features/decorators.py (Diff revision 1) Show all issues -
Review Request #9007 — Created June 9, 2017 and submitted
Information | |
---|---|
brennie | |
Djblets | |
release-0.10.x | |
Reviewers | |
djblets | |
The
@feature_required(f)
decorator makes the decorated view require
thef
feature to be enabled to be executed. Otherwise a backup view
will be called, which by default returns a 404 Not Found error. This
view may be customized by the caller to return any sort of response.
djblets/features/decorators.py (Diff revision 1) |
---|
djblets/features/decorators.py (Diff revision 2) |
---|
Thinking we may want to allow for a little more flexibility in what's returned here. A 404 might be appropriate for a lot of things, but a 403 might be for others. It might also be really nice to allow some other thing to be returned (redirect, custom page with instructions on requesting access to the thing, etc.).
How about letting
feature_required
take anot_enabled_view
argument that defaults tolambda *args, **kwargs: HttpResponseNotFound()
? Then callers could leave it at the default to get a 404, or could override the behavior to return whatever they want.
Address Christian's issues; add unit tests.
Description: |
|
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
||||||||||||||||||
Diff: |
Revision 3 (+125 -1) |