forked from 05bit/peewee-async
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
7 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
Copyright (c) 2016, Alexey Kinëv <[email protected]> | ||
""" | ||
# Start example [marker for docs] | ||
import tornado.web | ||
import logging | ||
import peewee | ||
|
@@ -78,7 +79,7 @@ async def get(self): | |
class CreateHandler(tornado.web.RequestHandler): | ||
async def get(self): | ||
loop = asyncio.get_event_loop() | ||
task1 = asyncio.Task.current_task() | ||
task1 = asyncio.Task.current_task() # Just to demonstrate it's None | ||
task2 = loop.create_task(self.get_or_create()) | ||
obj = await task2 | ||
self.write({ | ||
|