From d249ef0422e5f1d76869c7509a7a83646aec64b7 Mon Sep 17 00:00:00 2001 From: Cristhian Garcia Date: Thu, 12 Oct 2023 08:40:31 -0500 Subject: [PATCH] chore: remove utcnow function --- h5pxblock/h5pxblock.py | 5 +++-- h5pxblock/utils.py | 11 ----------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/h5pxblock/h5pxblock.py b/h5pxblock/h5pxblock.py index 47ca983e..89ad8a22 100644 --- a/h5pxblock/h5pxblock.py +++ b/h5pxblock/h5pxblock.py @@ -7,6 +7,8 @@ import pkg_resources from enum import Enum +from datetime import datetime + from django.conf import settings from django.utils import timezone from webob import Response @@ -31,7 +33,6 @@ str2bool, unpack_and_upload_on_cloud, unpack_package_local_path, - utcnow, ) # Make '_' a no-op so we can scrape strings @@ -434,7 +435,7 @@ def is_past_due(self): """ if not self.due: return False - return utcnow() > self.due + return datetime.now() > self.due @staticmethod def workbench_scenarios(): diff --git a/h5pxblock/utils.py b/h5pxblock/utils.py index 81d4620e..92475662 100644 --- a/h5pxblock/utils.py +++ b/h5pxblock/utils.py @@ -5,7 +5,6 @@ import logging import os import shutil -from datetime import datetime from zipfile import ZipFile, is_zipfile from django.conf import settings @@ -110,13 +109,3 @@ def unpack_and_upload_on_cloud(package, storage, path): if not os.path.basename(real_path) in {"", ".", ".."}: # skip invalid or dangerous paths future = executor.submit(storage.save, real_path, ContentFile(h5p_zip.read(zipfile_name))) future.add_done_callback(future_result_handler) - - -def utcnow(): - """ - Get current date and time in UTC. - - Returns: - datetime.datetime: Current date and time in UTC. - """ - return datetime.now()