On Tuesday, May 29, 2012, John Boxall wrote:

> Consider the following code:
>
>     def view(request):
>>         import pdb;pdb.set_trace()
>>         # Make a bunch of databases updates
>>         return HttpResponse('OKAY')
>
>
> I boot up the Django devserver and make a request from my browser. It is
> routed by Django to `view`. When the debugger launches, I cancel the
> request in my browser.
>
> It seems as though Django continues executing the code in the request
> path. Is this the expected behavior?
>

As a WSGI application, Django should have no
idea that the connection has been closed. The connection to the client is
just another resource, like a database connection or a memcache server.
Nothing will happen asynchronously to raise an exception; you'll only see
an exception at the point where you try to use the resource.


> If the connection has 'gone away' are there any circumstances where Django
> will raise an exception in the regular request path?
>

You're only going to see an exception at the point where you try to write
out to the http response object, and your wsgi server fails because the
other end of the connection is closed.

In django 1.4, http response is lazy, as well, so even writing directly to
it will probably not raise an exception until the view has returned, anyway.

Ian


> Cheers,
>
> John
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/M-mNNXY3vbQJ.
> To post to this group, send email to 
> django-users@googlegroups.com<javascript:_e({}, 'cvml', 
> 'django-users@googlegroups.com');>
> .
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com <javascript:_e({}, 'cvml',
> 'django-users%2bunsubscr...@googlegroups.com');>.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>


-- 
Regards,
Ian Clelland
<clell...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to