Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for "async with cursor_context()" #265

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f83c890
add support for "async with cursor_context()"
thehesiod Jan 26, 2017
c850e2b
fix pep warnings
thehesiod Jan 26, 2017
0ffd312
pep
thehesiod Jan 26, 2017
157c580
merge old style with new style
thehesiod Feb 17, 2017
e0d69bd
Merge remote-tracking branch 'aio-libs/master' into async_cursor
thehesiod Feb 17, 2017
0660956
add new testcase and remove unneeded statements
thehesiod Feb 17, 2017
8af3e6d
pep
thehesiod Feb 17, 2017
fd42c6c
use init trick from asyncpg
thehesiod Feb 17, 2017
4949621
bugfix
thehesiod Feb 17, 2017
bebe1b3
well that took awhile to figure out
thehesiod Feb 17, 2017
857abfd
pep
thehesiod Feb 17, 2017
e8a78b2
fix for py3.4
thehesiod Feb 17, 2017
bfbd60e
revise unittests
thehesiod Feb 17, 2017
623c368
arr
thehesiod Feb 17, 2017
4770379
refactor to use _PoolConnectionContextManager
thehesiod Feb 18, 2017
452e10b
remove unused code
thehesiod Feb 18, 2017
5da64ed
pep
thehesiod Feb 18, 2017
3897640
Merge remote-tracking branch 'aio-libs/master' into async_cursor
thehesiod Jul 4, 2017
375c6bf
simplify + update deps
thehesiod Jul 4, 2017
dabca4e
remove unused var
thehesiod Jul 4, 2017
cc05d18
attempt switching to the latest docker
thehesiod Jul 4, 2017
c8b506d
another attempt
thehesiod Jul 4, 2017
1e964ff
revert docker client upgrade
thehesiod Jul 4, 2017
1ca9b5f
revert docker client upgrade changes
thehesiod Jul 4, 2017
2321a82
Merge remote-tracking branch 'aio-libs/master' into async_cursor
thehesiod Jul 4, 2017
0a57593
add back missing change
thehesiod Jul 4, 2017
a5cec12
revert as this was later refactored
thehesiod Jul 4, 2017
a30fa02
Merge remote-tracking branch 'aio-libs/master' into async_cursor
thehesiod Sep 12, 2017
bdc39c3
add changes
thehesiod Sep 12, 2017
945b8fa
Merge remote-tracking branch 'aio-libs/master' into async_cursor
thehesiod Jan 4, 2018
dd94ae4
update from master
thehesiod Mar 15, 2018
351bcd8
fix merge
thehesiod Mar 15, 2018
60e9573
simplification
thehesiod Mar 15, 2018
256f7b8
add missing import
thehesiod Mar 17, 2018
02ca4e1
pep fix
thehesiod Mar 17, 2018
cbd93c5
integration fix
thehesiod Mar 17, 2018
4e52944
more merge fixes
thehesiod Mar 17, 2018
f613762
PEP fix
thehesiod Mar 17, 2018
3e4d0ba
Merge remote-tracking branch 'aio-libs/master' into async_cursor
thehesiod Sep 19, 2018
55b4b79
Merge remote-tracking branch 'aio-libs/master' into async_cursor
thehesiod Oct 16, 2018
1133c6a
fix merge bug
thehesiod Oct 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bugfix
  • Loading branch information
thehesiod committed Feb 17, 2017

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit 4949621f955d1f0c065a0f0e8c86a954d506298d
10 changes: 5 additions & 5 deletions aiopg/utils.py
Original file line number Diff line number Diff line change
@@ -193,20 +193,19 @@ def __aexit__(self, exc_type, exc_val, exc_tb):
class _PoolCursorContextManager:
"""Context manager.

This enables the following idiom for acquiring and releasing a
This enables the following idioms for acquiring and releasing a
cursor around a block:

with (yield from pool.cursor()) as cur:
yield from cur.execute("SELECT 1")

async with pool.cursor() as cur:
yield from cur.execute("SELECT 1")

while failing loudly when accidentally using:

with pool:
<block>

It also allows the following idiom:
async with pool.cursor_context() as cur:
yield from cur.execute("SELECT 1")
"""

__slots__ = ('_pool', '_conn', '_cur', '_conn_cur_co')
@@ -234,6 +233,7 @@ def _init(self):

yield from self._conn.__aenter__()
yield from self._cur.__aenter__()
return self

@asyncio.coroutine
def __await__(self):