2013-03-06 18:12:24 +08:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2013-05-19 23:55:12 +08:00
|
|
|
from django.db import connection, transaction
|
2013-03-06 18:12:24 +08:00
|
|
|
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))
|
|
|
|
|
2013-05-19 23:55:12 +08:00
|
|
|
@transaction.non_atomic_requests
|
2013-03-06 18:12:24 +08:00
|
|
|
def not_in_transaction(request):
|
|
|
|
return HttpResponse(str(connection.in_atomic_block))
|