forked from shaba/openuds
Added check for database connection problem on config
This commit is contained in:
parent
eb4be53508
commit
bde63f7b4f
@ -111,13 +111,17 @@ class Config:
|
||||
readed.field_type = self._type
|
||||
readed.save(update_fields=['field_type'])
|
||||
self._type = readed.field_type
|
||||
except Exception:
|
||||
# Not found
|
||||
except DBConfig.DoesNotExist:
|
||||
# Not found, so we create it
|
||||
if self._default != '' and self._crypt:
|
||||
self.set(cryptoManager().decrypt(self._default))
|
||||
elif not self._crypt:
|
||||
self.set(self._default)
|
||||
self._data = self._default
|
||||
except Exception as e:
|
||||
logger.info('Error accessing db config {0}.{1}'.format(self._section.name(), self._key))
|
||||
logger.exception(e)
|
||||
self._data = self._default
|
||||
|
||||
if self._crypt:
|
||||
return cryptoManager().decrypt(typing.cast(str, self._data))
|
||||
|
Loading…
Reference in New Issue
Block a user