[damned-lies] Add timezone to compared datetime in language_release_tar
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Add timezone to compared datetime in language_release_tar
- Date: Wed, 8 Dec 2021 17:13:20 +0000 (UTC)
commit 4f15e0b1e4428317883ada6c07ff9b3381017a3b
Author: Claude Paroz <claude 2xlibre net>
Date: Wed Dec 8 18:12:23 2021 +0100
Add timezone to compared datetime in language_release_tar
languages/views.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/languages/views.py b/languages/views.py
index cab905ae..9999cca0 100644
--- a/languages/views.py
+++ b/languages/views.py
@@ -1,6 +1,6 @@
import os
import tarfile
-from datetime import date, datetime
+from datetime import date, datetime, timezone
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect
@@ -83,7 +83,10 @@ def language_release_tar(request, locale, release_name, dtype):
if not os.access(tar_directory, os.R_OK):
os.mkdir(tar_directory)
tar_path = os.path.join(tar_directory, tar_filename)
- if not os.access(tar_path, os.R_OK) or last_modif > datetime.fromtimestamp(os.path.getmtime(tar_path)):
+ if (
+ not os.access(tar_path, os.R_OK) or
+ last_modif > datetime.fromtimestamp(os.path.getmtime(tar_path), timezone.utc)
+ ):
# Create a new tar file
tar_file = tarfile.open(tar_path, 'w:gz')
for f in file_list:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]