Merge pull request #206 from burke-software/master

Fix #191 need to check for psycopg2.InternalError too
This commit is contained in:
Bernardo Pires 2014-11-22 14:38:38 -05:00
commit 8119a9881c
1 changed files with 2 additions and 1 deletions

View File

@ -5,6 +5,7 @@ from django.utils.importlib import import_module
from django.core.exceptions import ImproperlyConfigured, ValidationError
from tenant_schemas.utils import get_public_schema_name, get_limit_set_calls
import django.db.utils
import psycopg2
ORIGINAL_BACKEND = getattr(settings, 'ORIGINAL_BACKEND', 'django.db.backends.postgresql_psycopg2')
@ -123,7 +124,7 @@ class DatabaseWrapper(original_backend.DatabaseWrapper):
# we do not have to worry that it's not the good one
try:
cursor.execute('SET search_path = {0}'.format(','.join(search_paths)))
except django.db.utils.DatabaseError:
except (django.db.utils.DatabaseError, psycopg2.InternalError):
self.search_path_set = False
else:
self.search_path_set = True