From 1d859569b63d061a072e2e071755288acf9a7922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Wed, 6 May 2020 18:34:28 +0200 Subject: [PATCH] Fix naive offset-naive/aware error in asset compilation The XBlockPackageStorage used to return offset-naive datetime objects which were compared to offset-aware objects when we ran static asset collection: ./manage.py lms collectstatic Close CRI-191 --- openedx/core/lib/xblock_pipeline/finder.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openedx/core/lib/xblock_pipeline/finder.py b/openedx/core/lib/xblock_pipeline/finder.py index 2cb3eb3ce3..aad79b8d44 100644 --- a/openedx/core/lib/xblock_pipeline/finder.py +++ b/openedx/core/lib/xblock_pipeline/finder.py @@ -9,6 +9,7 @@ from django.contrib.staticfiles import utils from django.contrib.staticfiles.finders import BaseFinder from django.contrib.staticfiles.storage import FileSystemStorage from django.core.files.storage import Storage +from django.utils import timezone from pkg_resources import resource_exists, resource_filename, resource_isdir, resource_listdir from xblock.core import XBlock @@ -80,19 +81,19 @@ class XBlockPackageStorage(Storage): """ Returns a URL to the package resource. """ - return datetime.fromtimestamp(os.path.getatime(self.path(name))) + return datetime.fromtimestamp(os.path.getatime(self.path(name)), timezone.utc) def get_created_time(self, name): """ Returns the created time of the package resource. """ - return datetime.fromtimestamp(os.path.getctime(self.path(name))) + return datetime.fromtimestamp(os.path.getctime(self.path(name)), timezone.utc) def get_modified_time(self, name): """ Returns the modified time of the resource. """ - return datetime.fromtimestamp(os.path.getmtime(self.path(name))) + return datetime.fromtimestamp(os.path.getmtime(self.path(name)), timezone.utc) def url(self, name): """