Tuesday, May 29, 2012

What is Django's behavior when a request is interrupted?

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?

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

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.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment