From 0e1bb6ab04e2825c20d29d43895f6591783cf28e Mon Sep 17 00:00:00 2001 From: Raphael Deem Date: Sat, 11 Feb 2017 16:27:38 -0800 Subject: [PATCH] add loop property --- sanic/sanic.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sanic/sanic.py b/sanic/sanic.py index 951632be..2979fe4c 100644 --- a/sanic/sanic.py +++ b/sanic/sanic.py @@ -49,6 +49,13 @@ class Sanic: # Register alternative method names self.go_fast = self.run + @property + def loop(self): + """ + Synonymous with asyncio.get_event_loop() + """ + return get_event_loop() + # -------------------------------------------------------------------- # # Registration # -------------------------------------------------------------------- # @@ -459,7 +466,7 @@ class Sanic: self.error_handler.debug = debug self.debug = debug - self.loop = loop = get_event_loop() + loop = self.loop server_settings = { 'protocol': protocol,