1
0
mirror of https://github.com/django/django.git synced 2024-12-23 17:46:27 +00:00
django/tests/handlers/views.py
Aymeric Augustin ac37ed21b3 Deprecated TransactionMiddleware and TRANSACTIONS_MANAGED.
Replaced them with per-database options, for proper multi-db support.

Also toned down the recommendation to tie transactions to HTTP requests.
Thanks Jeremy for sharing his experience.
2013-03-11 15:04:05 +01:00

18 lines
523 B
Python

from __future__ import unicode_literals
from django.db import connection
from django.http import HttpResponse, StreamingHttpResponse
def regular(request):
return HttpResponse(b"regular content")
def streaming(request):
return StreamingHttpResponse([b"streaming", b" ", b"content"])
def in_transaction(request):
return HttpResponse(str(connection.in_atomic_block))
def not_in_transaction(request):
return HttpResponse(str(connection.in_atomic_block))
not_in_transaction.transactions_per_request = False