Skip to content

Commit

Permalink
Merge pull request #538 from jazzband/dont-set-in-get
Browse files Browse the repository at this point in the history
Fix issue #510
  • Loading branch information
chrisclark authored Feb 5, 2024
2 parents 46fe20d + 6f0bb23 commit cb8ae39
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions constance/backends/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,16 @@ def mget(self, keys):

def get(self, key):
key = self.add_prefix(key)
value = None
if self._cache:
value = self._cache.get(key)
if value is None:
self.autofill()
value = self._cache.get(key)
else:
value = None
if value is None:
try:
value = self._model._default_manager.get(key=key).value
except (OperationalError, ProgrammingError, self._model.DoesNotExist):
pass
else:
match = self._model._default_manager.filter(key=key).first()
if match:
value = match.value
if self._cache:
self._cache.add(key, value)
return value
Expand Down

0 comments on commit cb8ae39

Please sign in to comment.