Jonathan Liuti
78e4ea0d6e
No auth view failing permission should raise 403
...
A view with no `authentication_classes` set and that fails a
permission check should raise a 403 with the message from the
failing permission.
2016-04-07 16:24:26 +01:00
Mohamad Nour Chawich
03270431ed
Reorder initializing the view
...
Determining the version and performing content negotiation should be done before ensuring the permission of the request. The reason is that these information can be used in handling the exceptions. For example different versions may return different error scheme. Also, the rendering class can be used to determine how to exception handler response should be rendered.
2016-03-20 21:46:37 +01:00
Tymur Maryokhin
4e5da16961
Remove Django 1.4 compat code
2015-08-07 00:02:29 +02:00
Tom Christie
1b3b01e042
Remove unused imports
2015-07-30 15:59:27 +01:00
Tom Christie
c203ca4c64
Deprecations
2015-07-30 15:26:42 +01:00
Tom Christie
bdeb28944f
Use RuntimeError, not AssertionError when guarding against direct View.queryset evalutation. Refs #3180 .
2015-07-24 09:13:39 +01:00
Tom Christie
108dfafa44
Fix Django 1.5/1.4 compat issue
2015-07-24 09:02:16 +01:00
Tom Christie
c0e3e670ca
Fix Django compat for Queryset import
2015-07-23 17:43:49 +01:00
Tom Christie
e05021c8c6
Guard against erronous direct .queryset evaluation in CBVs.
2015-07-23 17:17:18 +01:00
José Padilla
7351a3f6ca
Sort imports with isort
2015-06-25 16:55:51 -04:00
José Padilla
83c9136c90
Cleanup import following PEP 8 style guide
2015-06-25 16:10:17 -04:00
Tom Christie
8329411cc3
Merge pull request #2539 from donewell/permission-detail
...
add message to custom permission
2015-06-24 11:32:02 +01:00
Nicolas Delaby
c2d2417237
Tell default error handler to doom the transaction on error
...
if `ATOMIC_REQUESTS` is enabled.
2015-06-02 09:19:58 +02:00
Allard Hoeve
9a794beb1e
Remove mention of Django's built-in ValidationError in docstring
...
The `exception_handler` does not actually handle django.core.exceptions.ValidationError, so remove any mention of it.
This closes #2872
2015-04-24 15:37:42 +02:00
donewell
9a9a00bff2
simplify argument handling
2015-02-11 11:15:01 +00:00
donewell
9ea615af14
add message to custom permission
...
change detail to message and update text
2015-02-10 20:11:53 +00:00
Tom Christie
1f99612845
Upgrade pending deprecations to deprecations
2015-02-06 13:21:35 +00:00
Tom Christie
2cc4cb2465
Fix error text in test.
2015-01-31 08:53:40 +00:00
Tom Christie
6838f17325
Add built-in translations.
2015-01-30 16:41:21 +00:00
Tom Christie
6e51e4f5cd
Versioning first pass
2014-12-16 15:34:19 +00:00
José Padilla
4ebd8770b9
Update excepteion_handler signature
2014-12-14 20:47:33 -04:00
José Padilla
26c223a34f
Add get_exception_handler_context()
2014-12-14 16:43:58 -04:00
José Padilla
89e9fc98d6
Reuse exception_handler variable throughout
2014-12-14 15:20:44 -04:00
José Padilla
fd003fcefa
Add pending deprecation warning message
2014-12-14 15:03:20 -04:00
José Padilla
e8c0766568
Support handlers with and without context
2014-12-13 20:54:35 -04:00
José Padilla
0d109c90a7
Add context to exception handler #2236
...
Same context as renderers which include: the view,
args, kwargs, and request.
This provides enough contextual information to the
exception handlers to handle errors better.
In a use case like #1671 , a custom handler
would allow Sentry to log the request properly.
2014-12-13 18:18:00 -04:00
Tymur Maryokhin
d54c67d79d
Removed custom StringIO, force_text, smart_text compat
2014-12-04 03:11:42 +01:00
Tom Christie
d9a199ca0d
exceptions.ValidationFailed, not Django's ValidationError
2014-10-10 14:16:09 +01:00
Craig de Stigter
dfab9af294
Minor: fix spelling and grammar, mostly in 3.0 announcement
2014-10-03 08:41:18 +13:00
Tom Christie
f4b1dcb167
OPTIONS support
2014-09-24 14:09:49 +01:00
Tom Christie
6db3356c4d
NON_FIELD_ERRORS_KEY setting
2014-09-12 10:21:35 +01:00
Tom Christie
19b8f779de
Throttles now use Retry-After header and no longer support the custom style
2014-09-11 20:43:44 +01:00
Tom Christie
de301f3b66
Merge master
2014-09-11 13:20:44 +01:00
Tom Christie
21980b800d
More test sorting
2014-09-08 14:24:05 +01:00
Piper Merriam
fc9be55d43
Alter CSRF exemption implementation
...
The previous implementation of decorating `APIView.dispach` with the
`csrf_exempt` decorator allowed for an easy-to-make mistake where
someone could override the `dispatch` method on a view and inadvertantly
remove the csrf exemption of their api view.
By moving the decoration of the view into the `as_view` logic, it
becomes much more difficult to make this mistake.
2014-09-03 09:50:31 -06:00
Dmitry Mukhin
3b07d0c997
Merge branch 'master' into set-retry-after
...
Conflicts:
tests/test_throttling.py
2014-08-20 20:04:48 +04:00
Tom Christie
bf09c32de8
Code linting and added runtests.py
2014-08-19 13:28:07 +01:00
Dmitry Mukhin
c3891b6e00
set Retry-After header when throttled
2014-04-07 20:31:12 +04:00
David Larlet
07cb436d61
Typo in keywords arguments name
...
Because it matters ;)
2014-03-04 16:32:34 +01:00
hongfeiZhang
693d9d9c63
In the method permission_denied, did not use the request parameter.
2014-03-01 11:37:31 +08:00
Tom Christie
18f26ff5cc
Only add 'Vary: Accept' header when there is more than one possible renderer.
2014-01-30 17:47:55 +00:00
Tom Christie
9f0ead9597
Remove TODO note, since it hasn't been TODONE.
2014-01-30 17:32:05 +00:00
Tom Christie
6302307885
Update comment in get_parser_context
.
2013-10-24 13:45:16 +01:00
Andy Freeland
b5523bcc7d
Support customizable view EXCEPTION_HANDLER
...
Add `api_settings.EXCEPTION_HANDLER` to support custom error responses.
Fixes #907 .
2013-09-06 12:47:33 -05:00
Tom Christie
b54cbd292c
Use view.settings for API settings, to make testing easier.
2013-08-27 12:36:06 +01:00
Tom Christie
b430503fa6
Move exception handler out of main view
2013-08-27 12:32:33 +01:00
Tom Christie
5120670624
Document customizable view names/descriptions
2013-08-19 08:45:53 +01:00
Tom Christie
89b0a539c3
Move view name/description functions into public space
2013-08-19 08:24:27 +01:00
Christopher Paolini
e6662d434f
Improved view/description function setting
...
Now supports each View having its own name and description function and
overriding the global default.
2013-08-17 17:44:51 -04:00
Jeremy Satterfield
1d8a80f5cc
don't set X-Throttle-Wait-Second header if throttle wait is None
2013-08-13 15:31:58 -05:00