add loop property

This commit is contained in:
Raphael Deem 2017-02-11 16:27:38 -08:00
parent 75fca1b9c7
commit 0e1bb6ab04

View File

@ -49,6 +49,13 @@ class Sanic:
# Register alternative method names # Register alternative method names
self.go_fast = self.run self.go_fast = self.run
@property
def loop(self):
"""
Synonymous with asyncio.get_event_loop()
"""
return get_event_loop()
# -------------------------------------------------------------------- # # -------------------------------------------------------------------- #
# Registration # Registration
# -------------------------------------------------------------------- # # -------------------------------------------------------------------- #
@ -459,7 +466,7 @@ class Sanic:
self.error_handler.debug = debug self.error_handler.debug = debug
self.debug = debug self.debug = debug
self.loop = loop = get_event_loop() loop = self.loop
server_settings = { server_settings = {
'protocol': protocol, 'protocol': protocol,