-
Notifications
You must be signed in to change notification settings - Fork 418
expose method is_in_transaction #297
New issue
Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “No 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? No Sign in to your account
Conversation
|
@elprans Does |
"or". But write a test first and see what's actually going on there. |
I think we should always rely only on the protocol state. |
Fair enough; the protocol state gets set when a Can someone with more travis-ci experience than me explain why https://travis-ci.org/MagicStack/asyncpg/jobs/385397537 failed? Looks like curl failed to get a python3.5 install, but it's not clear to me why. |
Yes
Looks like a Travis fluke. I restarted the job. |
asyncpg/connection.py
Outdated
def is_in_transaction(self): | ||
"""Return True if Connection is currently inside a transaction | ||
|
||
:return bool: True if inside transaction, False otherwise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add :versionadded: 0.16.0
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax you provided was slightly different than that I found elsewhere in the file, correct me if this is wrong
asyncpg/connection.py
Outdated
@@ -204,6 +204,14 @@ def transaction(self, *, isolation='read_committed', readonly=False, | |||
self._check_open() | |||
return transaction.Transaction(self, isolation, readonly, deferrable) | |||
|
|||
def is_in_transaction(self): | |||
"""Return True if Connection is currently inside a transaction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a .
at the end of all sentences please.
Thank you! |
Added method checking the state of
_top_xact
.I'm not familiar with the library's version number usage, so I just bumped the lowest element of the version number. Correct me if this is wrong.