Merge pull request #409 from r0fls/loop-attribute

add loop property
This commit is contained in:
Eli Uriegas 2017-02-11 18:31:51 -06:00 committed by GitHub
commit cf3f943feb

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,