summaryrefslogtreecommitdiff
path: root/django/core/cache
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2025-02-18 08:35:36 +0100
committerGitHub <noreply@github.com>2025-02-18 08:35:36 +0100
commitefb7f9ced2dcf71294353596a265e3fd67faffeb (patch)
treeb24b6127022fbe48c517d1acbe9e3c0c502391d9 /django/core/cache
parent0d1dd6bba0c18b7feb6caa5cbd8df80fbac54afd (diff)
Refs #36005 -- Used datetime.UTC alias instead of datetime.timezone.utc.
datetime.UTC was added in Python 3.11.
Diffstat (limited to 'django/core/cache')
-rw-r--r--django/core/cache/backends/db.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/core/cache/backends/db.py b/django/core/cache/backends/db.py
index f41105177f..d231d66b2f 100644
--- a/django/core/cache/backends/db.py
+++ b/django/core/cache/backends/db.py
@@ -1,7 +1,7 @@
"Database cache backend."
import base64
import pickle
-from datetime import datetime, timezone
+from datetime import UTC, datetime
from django.conf import settings
from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache
@@ -124,7 +124,7 @@ class DatabaseCache(BaseDatabaseCache):
if timeout is None:
exp = datetime.max
else:
- tz = timezone.utc if settings.USE_TZ else None
+ tz = UTC if settings.USE_TZ else None
exp = datetime.fromtimestamp(timeout, tz=tz)
exp = exp.replace(microsecond=0)
if num > self._max_entries: