Skip to content

Commit

Permalink
Replace try / except block with condition.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiocaccamo committed Dec 11, 2022
1 parent 8082ae2 commit 52369bf
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions maintenance_mode/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ class StaticStorageBackend(AbstractStateBackend):

def get_value(self):
filename = settings.MAINTENANCE_MODE_STATE_FILE_NAME
try:
if staticfiles_storage.exists(filename):
with staticfiles_storage.open(filename, "r") as statefile:
return self.from_str_to_bool_value(statefile.read())
except IOError:
return False
return False

def set_value(self, value):
filename = settings.MAINTENANCE_MODE_STATE_FILE_NAME
Expand Down

0 comments on commit 52369bf

Please sign in to comment.