From 7fe418d1b7c0d6fd03104f8a641da5c08a114da6 Mon Sep 17 00:00:00 2001 From: 38elements Date: Wed, 12 Apr 2017 17:55:22 +0900 Subject: [PATCH 1/3] Refactor keep_alive --- sanic/server.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sanic/server.py b/sanic/server.py index 7868836c..40c3ee69 100644 --- a/sanic/server.py +++ b/sanic/server.py @@ -89,6 +89,10 @@ class HttpProtocol(asyncio.Protocol): self._last_request_time = None self._request_handler_task = None + @property + def keep_alive(self): + return self.parser.should_keep_alive() and not self.signal.stopped + # -------------------------------------------- # # Connection # -------------------------------------------- # @@ -182,9 +186,7 @@ class HttpProtocol(asyncio.Protocol): Writes response content synchronously to the transport. """ try: - keep_alive = ( - self.parser.should_keep_alive() and not self.signal.stopped) - + keep_alive = self.keep_alive self.transport.write( response.output( self.request.version, keep_alive, @@ -218,9 +220,7 @@ class HttpProtocol(asyncio.Protocol): """ try: - keep_alive = ( - self.parser.should_keep_alive() and not self.signal.stopped) - + keep_alive = self.keep_alive response.transport = self.transport await response.stream( self.request.version, keep_alive, self.request_timeout) From 6b2883074be3279734b11d3f2666e383ae42b744 Mon Sep 17 00:00:00 2001 From: "adam.serafini" Date: Wed, 12 Apr 2017 10:59:03 +0200 Subject: [PATCH 2/3] Fix installation on Ubuntu 16.10 Fixes issue #629. Printing a unicode string at the end of the setup.py script is asking for trouble. It's also redundant: the pip tool itself tells the user whether the installation was successful or not. --- setup.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/setup.py b/setup.py index deb52c27..aa5f2b08 100644 --- a/setup.py +++ b/setup.py @@ -64,7 +64,3 @@ except DistutilsPlatformError as exception: print("Installing without uJSON or uvLoop") setup_kwargs['install_requires'] = requirements setup(**setup_kwargs) - -# Installation was successful -print(u"\n\n\U0001F680 " - "Sanic version {} installation suceeded.\n".format(version)) From 235e5511ebee6fcd53ad1e056d44df55bea3d44b Mon Sep 17 00:00:00 2001 From: "adam.serafini" Date: Wed, 12 Apr 2017 11:02:13 +0200 Subject: [PATCH 3/3] Bump version --- sanic/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sanic/__init__.py b/sanic/__init__.py index 7bf0994a..7ddeb1ea 100644 --- a/sanic/__init__.py +++ b/sanic/__init__.py @@ -1,6 +1,6 @@ from sanic.app import Sanic from sanic.blueprints import Blueprint -__version__ = '0.5.0' +__version__ = '0.5.1' __all__ = ['Sanic', 'Blueprint']