From b6ea32d35d3a2b6692aa855e9679aefab4ecc2d5 Mon Sep 17 00:00:00 2001 From: Ahmed El-Hassany Date: Thu, 24 May 2012 13:23:34 -0400 Subject: [PATCH] Better connection check in RequestHandler --- tornado/web.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tornado/web.py b/tornado/web.py index b90324f9..fa1fcd55 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -123,7 +123,7 @@ class RequestHandler(object): self.ui["modules"] = self.ui["_modules"] self.clear() # Check since connection is not available in WSGI - if hasattr(self.request, "connection"): + if getattr(self.request, "connection", None): self.request.connection.stream.set_close_callback( self.on_connection_close) self.initialize(**kwargs)