-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix interface error when downloading taxa list (#4131)
- Loading branch information
1 parent
14595e7
commit 4d24e97
Showing
5 changed files
with
17 additions
and
6 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import django.db | ||
from psycopg2 import InterfaceError | ||
from django_tenants.postgresql_backend.base import ( | ||
DatabaseWrapper as TenantDatabaseWrapper | ||
) | ||
|
||
|
||
class DatabaseWrapper(TenantDatabaseWrapper): | ||
def create_cursor(self, name=None): | ||
try: | ||
return super().create_cursor(name=name) | ||
except InterfaceError: | ||
django.db.close_old_connections() | ||
django.db.connection.connect() | ||
return super().create_cursor(name=name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters