socket.from_fd return a _socket.socket object instead of socket.socket

(at least on py26). Instead of testing type of instance, just test if
the source has a "recv" method. Fix bug in usr2 with new parser.
This commit is contained in:
benoitc 2010-06-16 11:30:36 +02:00
parent 05b6281e8d
commit d5b76ac651

View File

@ -11,7 +11,7 @@ from gunicorn.http.unreader import SocketUnreader, IterUnreader
class Parser(object):
def __init__(self, mesg_class, source):
self.mesg_class = mesg_class
if isinstance(source, socket.socket):
if hasattr(source, "recv"):
self.unreader = SocketUnreader(source)
else:
self.unreader = IterUnreader(source)