Fix order of psycopg2cffi.compat.register() call and psycogreen.gevent.patch_psycopg() call, demote threading module exception to warning.

This commit is contained in:
Tyson Clugg 2015-11-05 14:42:24 +11:00
parent 120d5327fd
commit 5ec0c392d3

View file

@ -25,12 +25,10 @@ def greenify():
from gevent.monkey import patch_all, saved
if ('threading' in sys.modules) and ('threading' not in saved):
raise Exception('threading module loaded before patching!')
import warnings
warnings.warn('threading module loaded before patching!')
patch_all()
from psycogreen.gevent import patch_psycopg
patch_psycopg()
try:
# Use psycopg2 by default
import psycopg2
@ -40,6 +38,9 @@ def greenify():
from psycopg2cffi import compat
compat.register()
from psycogreen.gevent import patch_psycopg
patch_psycopg()
class AlreadyRegistered(Exception):