Skip to content

Commit

Permalink
WebSocketReady at module namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
esaezgil committed Jul 30, 2016
1 parent 187c85a commit c154a76
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions aiohttp/web_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

THRESHOLD_CONNLOST_ACCESS = 5

WebSocketReady = namedtuple('WebSocketReady', 'ok protocol')


class WebSocketResponse(StreamResponse):

Expand All @@ -38,8 +40,6 @@ def __init__(self, *,
self._timeout = timeout
self._autoclose = autoclose
self._autoping = autoping
self._web_socket_ready = namedtuple('web_socket_ready',
'ok protocol')

@asyncio.coroutine
def prepare(self, request):
Expand Down Expand Up @@ -100,9 +100,9 @@ def can_prepare(self, request):
request.method, request.headers, request.transport,
self._protocols)
except HttpProcessingError:
return self._web_socket_ready(False, None)
return WebSocketReady(False, None)
else:
return self._web_socket_ready(True, protocol)
return WebSocketReady(True, protocol)

def can_start(self, request):
warnings.warn('use .can_prepare(request) instead', DeprecationWarning)
Expand Down

0 comments on commit c154a76

Please sign in to comment.