Opened 7 years ago
Last modified 7 years ago
#29303 new Bug
non_atomic_requests decorator alters _non_atomic_requests attribute of original function — at Initial Version
Description ¶
When calling non_atomic_requests
with a function, it alters the _non_atomic_requests
attribute of the original function.
Here's an example:
from django.db import transaction @transaction.non_atomic_requests(using='default') def my_view(request): return HttpResponse('') assert my_view._non_atomic_requests == {'default'} # passes wrapped_view = transaction.non_atomic_requests(using='other') assert wrapped_view._non_atomic_requests == {'default', 'other'} # passes assert my_view._non_atomic_requests == {'default'} # fails
I realise that this is a contrived example. It isn't an issue when non_atomic_requests
is used as a decorator:
@transaction.non_atomic_requests(using='default') @transaction.non_atomic_requests(using='other') def my_view(request) return HttpResponse('')
According to the ticket's flags, the next step(s) to move this issue forward are:
- To provide a patch by sending a pull request. Claim the ticket when you start working so that someone else doesn't duplicate effort. Before sending a pull request, review your work against the patch review checklist. Check the "Has patch" flag on the ticket after sending a pull request and include a link to the pull request in the ticket comment when making that update. The usual format is:
[https://github.com/django/django/pull/#### PR]
.
Note:
See TracTickets
for help on using tickets.