Skip to content

Commit

Permalink
Merge pull request #11 from Pearson-Advance/vue/PADV-1558
Browse files Browse the repository at this point in the history
PADV-1558 add default storage instances on utils.py
  • Loading branch information
Nekenhei authored Dec 12, 2024
2 parents 4808b38 + 9b5e8d6 commit 083da24
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions edx_sga/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ def get_default_storage():
# If settings not defined, use default_storage from Django
return django_default_storage

default_storage = get_default_storage()

def utcnow():
"""
Get current date and time in UTC
Expand Down Expand Up @@ -67,7 +65,7 @@ def get_file_modified_time_utc(file_path):
else pytz.utc
)

file_time = default_storage.get_modified_time(file_path)
file_time = get_default_storage().get_modified_time(file_path)

if file_time.tzinfo is None:
return file_timezone.localize(file_time).astimezone(pytz.utc)
Expand Down Expand Up @@ -99,5 +97,5 @@ def file_contents_iter(file_path):
"""
Returns an iterator over the contents of a file located at the given file path
"""
file_descriptor = default_storage.open(file_path)
file_descriptor = get_default_storage().open(file_path)
return iter(partial(file_descriptor.read, BLOCK_SIZE), b"")

0 comments on commit 083da24

Please sign in to comment.