mirror of
https://github.com/jazzband/django-ddp.git
synced 2026-03-16 22:40:24 +00:00
Work towards #16 -- Use psycopg2cffi compatibility if psycopg2 not installed.
This commit is contained in:
parent
73465d6ed4
commit
397e044ddd
1 changed files with 8 additions and 1 deletions
|
|
@ -6,7 +6,6 @@ from pkg_resources import get_distribution, DistributionNotFound
|
|||
from gevent.local import local
|
||||
from dddp import alea
|
||||
|
||||
|
||||
try:
|
||||
_dist = get_distribution('django-ddp')
|
||||
if not __file__.startswith(os.path.join(_dist.location, 'django-ddp', '')):
|
||||
|
|
@ -43,6 +42,14 @@ def greenify():
|
|||
# ensure we don't greenify again
|
||||
_GREEN[True] = True
|
||||
|
||||
try:
|
||||
# Use psycopg2 by default
|
||||
import psycopg2
|
||||
except ImportError:
|
||||
# Fallback to psycopg2cffi if required (eg: pypy)
|
||||
from psycopg2cffi import compat
|
||||
compat.register()
|
||||
|
||||
|
||||
class AlreadyRegistered(Exception):
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue