django-rest-framework/rest_framework
Adam Johnson 5e5f559b4d Improve set_rollback() behaviour
\## Description

Fixes #6921.

Added tests that fail before and pass afterwards.

Remove the check for `connection.in_atomic_block` to determine if the current request is under a `transaction.atomic` from `ATOMIC_REQUESTS`. Instead, duplicate the method that Django itself uses [in BaseHandler](964dd4f4f2/django/core/handlers/base.py (L64)).

This requires fetching the actual view function from `as_view()`, as seen by the URL resolver / BaseHandler. Since this requires `request`, I've also changed the accesses in `get_exception_handler_context` to be direct attribute accesses rather than `getattr()`. It seems the `getattr` defaults not accessible since `self.request`, `self.args`, and `self.kwargs` are always set in `dispatch()` before `handle_exception()` can ever be called. This is useful since `request` is always needed for the new `set_rollback` logic.
2019-12-13 18:27:31 +00:00
..
authtoken Version 3.10.1 (#6817) 2019-07-17 14:17:45 +01:00
locale Version 3.10 (#6802) 2019-07-15 12:31:09 +01:00
management Add --urlconf to the generateschema command (#6696) 2019-06-09 15:23:52 +02:00
schemas Fix Django 3.0 deprecations (#7074) 2019-12-04 14:14:43 -08:00
static/rest_framework Update bootstrap to 3.4.1 (#6923) 2019-11-11 16:41:10 -05:00
templates/rest_framework upgrade jQuery to latest version (#6728) 2019-07-01 13:16:21 +01:00
templatetags replace force_text with force_str 2019-08-07 21:05:24 +02:00
utils Changed default widget for TextField with choices to select (#6892) 2019-12-04 12:24:49 -08:00
__init__.py Version 3.11 (#7083) 2019-12-12 14:31:40 +00:00
apps.py Make DEFAULT_PAGINATION_CLASS None by default. (#5170) 2017-09-25 15:36:30 +02:00
authentication.py Replace all usage ugettext functions with the non-u versions (#6634) 2019-05-01 07:49:54 +02:00
checks.py Clarify pagination system check (#5524) 2017-10-23 12:31:59 +02:00
compat.py Version 3.10.1 (#6817) 2019-07-17 14:17:45 +01:00
decorators.py Improve the docstring on @action (#6951) 2019-12-11 15:08:54 -08:00
documentation.py Ability to specify urlconf in include_docs_urls added (#6824) 2019-07-23 12:06:03 +01:00
exceptions.py replace force_text with force_str 2019-08-07 21:05:24 +02:00
fields.py Fix NotImplementedError for Field.to_internal_value and Field.to_representation (#6996) 2019-12-12 14:09:34 +00:00
filters.py replace force_text with force_str 2019-08-07 21:05:24 +02:00
generics.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
metadata.py replace force_text with force_str 2019-08-07 21:05:24 +02:00
mixins.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
negotiation.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
pagination.py Add support for pagination in OpenAPI response schemas (#6867) 2019-09-03 15:25:44 +02:00
parsers.py replace force_text with force_str 2019-08-07 21:05:24 +02:00
permissions.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
relations.py Fix Django 3.0 deprecations (#7074) 2019-12-04 14:14:43 -08:00
renderers.py Version 3.11 (#7083) 2019-12-12 14:31:40 +00:00
request.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
response.py Remove unnecessary bytes() calls (#6626) 2019-05-30 15:05:27 -07:00
reverse.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
routers.py Update framework deprecation warnings (#7075) 2019-12-04 16:18:38 -08:00
serializers.py Fix serializer multiple inheritance bug (#6980) 2019-12-12 14:03:55 +00:00
settings.py Update default settings to use lists instead of tuples (#6799) 2019-07-15 11:54:46 +01:00
status.py Adding I'm a teapot error code (#7081) 2019-12-10 09:18:35 +00:00
test.py Remove unnecessary bytes() calls (#6626) 2019-05-30 15:05:27 -07:00
throttling.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
urlpatterns.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
urls.py Dropped Python 2 compatibility. (#6615) 2019-04-30 17:53:44 +02:00
validators.py Fix UniqueTogetherValidator with field sources (#7086) 2019-12-12 13:02:30 +00:00
versioning.py Replace all usage ugettext functions with the non-u versions (#6634) 2019-05-01 07:49:54 +02:00
views.py Improve set_rollback() behaviour 2019-12-13 18:27:31 +00:00
viewsets.py Fix typos (#6835) 2019-07-25 10:04:01 -07:00