Added to catch ProgrammingError when checking whether a user is in use in the Mia core application.
This commit is contained in:
parent
35b246077c
commit
5e321ad420
@ -22,7 +22,8 @@ import hashlib
|
||||
|
||||
from dirtyfields import DirtyFieldsMixin
|
||||
from django.conf import settings
|
||||
from django.db import models, connection, OperationalError, transaction
|
||||
from django.db import models, connection, OperationalError, transaction, \
|
||||
ProgrammingError
|
||||
from django.db.models.functions import Now
|
||||
from django.urls import reverse
|
||||
|
||||
@ -185,6 +186,8 @@ class User(DirtyFieldsMixin, models.Model):
|
||||
cursor.execute(sql, [self.pk, self.pk])
|
||||
except OperationalError:
|
||||
return False
|
||||
except ProgrammingError:
|
||||
return False
|
||||
if cursor.fetchone() is None:
|
||||
return False
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user