Skip to content

Commit

Permalink
chore: remove utcnow function
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Oct 12, 2023
1 parent f7afdf7 commit d249ef0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
5 changes: 3 additions & 2 deletions h5pxblock/h5pxblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,7 +33,6 @@
str2bool,
unpack_and_upload_on_cloud,
unpack_package_local_path,
utcnow,
)

# Make '_' a no-op so we can scrape strings
Expand Down Expand Up @@ -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():
Expand Down
11 changes: 0 additions & 11 deletions h5pxblock/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

0 comments on commit d249ef0

Please sign in to comment.