Skip to content

Commit

Permalink
Merge pull request #409 from r0fls/loop-attribute
Browse files Browse the repository at this point in the history
add loop property
  • Loading branch information
seemethere committed Feb 12, 2017
2 parents 55c4d58 + 0e1bb6a commit cf3f943
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sanic/sanic.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ def __init__(self, name=None, router=None,
# Register alternative method names
self.go_fast = self.run

@property
def loop(self):
"""
Synonymous with asyncio.get_event_loop()
"""
return get_event_loop()

# -------------------------------------------------------------------- #
# Registration
# -------------------------------------------------------------------- #
Expand Down Expand Up @@ -459,7 +466,7 @@ def _helper(self, host="127.0.0.1", port=8000, debug=False,

self.error_handler.debug = debug
self.debug = debug
self.loop = loop = get_event_loop()
loop = self.loop

server_settings = {
'protocol': protocol,
Expand Down

0 comments on commit cf3f943

Please sign in to comment.