[Django] #26072: Errno 10053 occured when use login_required view with ajax

13 views
Skip to first unread message

Django

unread,
Jan 11, 2016, 10:16:27 PM1/11/16
to django-...@googlegroups.com
#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.

Django

unread,
Jan 12, 2016, 6:48:57 AM1/12/16
to django-...@googlegroups.com
#26072: Errno 10053 occured when use login_required view with ajax
-------------------------------+--------------------------------------
Reporter: JunLuo | Owner: nobody
Type: Uncategorized | Status: closed
Component: contrib.auth | Version: 1.8
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by timgraham):

* status: new => closed
* needs_better_patch: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_docs: => 0


Comment:

I guess this may be [https://bugs.python.org/issue14574 a problem in
Python] instead of an issue with Django. If you can explain why Django is
at fault, feel free to reopen. If you need help debugging, please see
TicketClosingReasons/UseSupportChannels.

--
Ticket URL: <https://code.djangoproject.com/ticket/26072#comment:1>

Reply all
Reply to author
Forward
0 new messages