Skip to content

Commit

Permalink
Merge pull request #49 from kammala/patch-2
Browse files Browse the repository at this point in the history
Compatibility fixes
  • Loading branch information
rudyryk committed Mar 5, 2017
2 parents 9ba1e55 + 28e6b49 commit b16e3fe
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion peewee_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
logger = logging.getLogger('peewee.async')
logger.addHandler(logging.NullHandler())


def get_peewee_version_tuple():
return tuple(peewee.__version__.split('.'))

PEEWEE_VERSION = get_peewee_version_tuple()

try:
import aiopg
except ImportError:
Expand Down Expand Up @@ -1485,7 +1491,11 @@ def _run_sql(database, operation, *args, **kwargs):
"""
logger.debug((operation, args, kwargs))

with database.exception_wrapper():
exception_wrapper = database.exception_wrapper
if PEEWEE_VERSION <= (2, 8, 5):
exception_wrapper = exception_wrapper()

with exception_wrapper:
cursor = yield from database.cursor_async()

try:
Expand Down

0 comments on commit b16e3fe

Please sign in to comment.