Projet

Général

Profil

0001-compat-ignore-error-on-checking-db-vendor-fixes-2992.patch

Benjamin Dauvergne, 22 janvier 2019 14:31

Télécharger (1,36 ko)

Voir les différences:

Subject: [PATCH] compat: ignore error on checking db vendor (fixes #29926)

compat can be loaded before initialization of db in tests, we must
ignore errors at such a time.
 src/authentic2/compat.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
src/authentic2/compat.py
4 4
import django
5 5
from django.conf import settings
6 6
from django.db import connection
7
from django.db.utils import OperationalError
8
from django.core.exceptions import ImproperlyConfigured
7 9

  
8 10
from django.contrib.auth.tokens import PasswordResetTokenGenerator
9 11

  
......
25 27

  
26 28

  
27 29
def has_postgresql_support():
28
    if not settings.DATABASES['default'].get('NAME'):
30
    try:
31
        return connection.vendor == 'postgresql' and connection.pg_version > 90400
32
    except (ImproperlyConfigured, OperationalError):
33
        # database is not initialized, be conservative
29 34
        return False
30
    return connection.vendor == 'postgresql' and connection.pg_version > 90400
31 35

  
32 36

  
33 37
def use_django_native_field():
34
-