diff options
| author | James Aylett <james@tartarus.org> | 2016-02-09 15:00:14 +0000 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-02-23 18:51:43 -0500 |
| commit | 1ff6e37de46f0cbf271a287a0ca67678e741a90a (patch) | |
| tree | 00db8ec13fb90be9ffecdbf5442a14bc91487dff /tests/staticfiles_tests | |
| parent | eda306f1cec20d490d5dc798ddaa8e8e8d13f26e (diff) | |
Fixed #23832 -- Added timezone aware Storage API.
New Storage.get_{accessed,created,modified}_time() methods convert the
naive time from now-deprecated {accessed,created_modified}_time()
methods into aware objects in UTC if USE_TZ=True.
Diffstat (limited to 'tests/staticfiles_tests')
| -rw-r--r-- | tests/staticfiles_tests/storage.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/staticfiles_tests/storage.py b/tests/staticfiles_tests/storage.py index fe4811a495..3e972552f2 100644 --- a/tests/staticfiles_tests/storage.py +++ b/tests/staticfiles_tests/storage.py @@ -2,12 +2,12 @@ from datetime import datetime from django.contrib.staticfiles.storage import CachedStaticFilesStorage from django.core.files import storage +from django.utils import timezone class DummyStorage(storage.Storage): """ - A storage class that does implement modified_time() but raises - NotImplementedError when calling + A storage class that implements get_modified_time(). """ def _save(self, name, content): return 'dummy' @@ -18,8 +18,8 @@ class DummyStorage(storage.Storage): def exists(self, name): pass - def modified_time(self, name): - return datetime.date(1970, 1, 1) + def get_modified_time(self, name): + return datetime.datetime(1970, 1, 1, tzinfo=timezone.utc) class SimpleCachedStaticFilesStorage(CachedStaticFilesStorage): |
