#26072: Errno 10053 occured when use login_required view with ajax
-------------------------------+--------------------
Reporter: JunLuo | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.auth | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------
url.py:
{{{
url(r'realtime_index$',views.get_realtime_index,
name='realtime_index'),
}}}
js:
{{{
$.ajax({
data : {
test:"just test",
},
type : 'post',
url : '/realtime_index',
dataType : 'json',
timeout : 5000,
success : function(result) {
alert(result);
}
});
}}}
view:
{{{
def get_realtime_index(request):
test= request.POST.get('test')
context = {
'test':test + " in view",
}
return HttpResponse(json.dumps(context),
content_type="application/json")
}}}
It works.
But when I changed url like bellow:
url(r'realtime_index$',
login_required(login_url='/auths/login')(views.get_realtime_index),
name='realtime_index'),
when js function called, django throw an exception like this:
{{{
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 53555)
Traceback (most recent call last):
File "C:\Python27\lib\SocketServer.py", line 595, in
process_request_thread
self.finish_request(request, client_address)
File "C:\Python27\lib\SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python27\lib\site-
packages\django-1.8.7-py2.7.egg\django\core\servers
\basehttp.py", line 102, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "C:\Python27\lib\SocketServer.py", line 653, in __init__
self.finish()
File "C:\Python27\lib\SocketServer.py", line 712, in finish
self.wfile.close()
File "C:\Python27\lib\socket.py", line 279, in close
self.flush()
File "C:\Python27\lib\socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 10053]
}}}
Can somebody tell me how to fix it?
--
Ticket URL: <https://code.djangoproject.com/ticket/26072>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/049.a1aef1a700c1f93fe55d07451dd3602a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.