From patchwork Tue Jan 16 17:58:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Veronika Kabatova X-Patchwork-Id: 861825 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zLdLn6NlCz9s7M for ; Wed, 17 Jan 2018 05:01:05 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3zLdLn40GMzF0bl for ; Wed, 17 Jan 2018 05:01:05 +1100 (AEDT) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=redhat.com (client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=vkabatov@redhat.com; receiver=) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3zLdJF20YjzF0VD for ; Wed, 17 Jan 2018 04:58:53 +1100 (AEDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 076DFBDCC for ; Tue, 16 Jan 2018 17:58:51 +0000 (UTC) Received: from vkabatova.usersys.redhat.com (unknown [10.43.17.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1CA1F61F20; Tue, 16 Jan 2018 17:58:48 +0000 (UTC) From: vkabatov@redhat.com To: patchwork@lists.ozlabs.org Subject: [PATCH v2] Avoid timezone confusion Date: Tue, 16 Jan 2018 18:58:06 +0100 Message-Id: <20180116175806.21832-1-vkabatov@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 16 Jan 2018 17:58:51 +0000 (UTC) X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" From: Veronika Kabatova Patchwork saves patches, comments etc with UTC timezone and reports this time when opening the patch details. However, internally generated processes such as events are reported with the instance's local time. There's nothing wrong with that and making PW timezone-aware would add useless complexity, but in a world-wide collaboration a lot of confusion may arise as the timezone is not reported at all. Instance's local time might be very different from the local time of CI integrating with PW, which is different from the local time of person dealing with it etc. Use UTC everywhere by default instead of UTC for sumbissions and local timezone for internally generated events (which is not reported). Signed-off-by: Veronika Kabatova --- docs/api/rest.rst | 4 +++- docs/deployment/installation.rst | 8 ++++++++ patchwork/settings/base.py | 2 +- patchwork/templates/patchwork/submission.html | 4 ++-- releasenotes/notes/unify-timezones-0f7022f0c2a371be.yaml | 5 +++++ 5 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/unify-timezones-0f7022f0c2a371be.yaml diff --git a/docs/api/rest.rst b/docs/api/rest.rst index 3d7292e..66aee72 100644 --- a/docs/api/rest.rst +++ b/docs/api/rest.rst @@ -107,7 +107,9 @@ Schema ------ Responses are returned as JSON. Blank fields are returned as ``null``, rather -than being omitted. Timestamps use the ISO 8601 format:: +than being omitted. Timestamps use the ISO 8601 format, times are by default +in UTC (:ref:`overridable` by ``TIME_ZONE`` +setting):: YYYY-MM-DDTHH:MM:SSZ diff --git a/docs/deployment/installation.rst b/docs/deployment/installation.rst index a570dd8..679312b 100644 --- a/docs/deployment/installation.rst +++ b/docs/deployment/installation.rst @@ -267,6 +267,8 @@ below: STATIC_ROOT = '/var/www/patchwork' +.. _deployment-other-options: + Other Options ^^^^^^^^^^^^^ @@ -281,6 +283,12 @@ setting overridden. The purpose of many of these variables is described in * ``DEFAULT_FROM_EMAIL`` * ``NOTIFICATION_FROM_EMAIL`` +.. note:: + + The default time zone is set to UTC. After changing, internally triggered + events will report time using this new timezone but submissions from emails + (cover letters, patches, comments) will still use UTC. + You can generate the ``SECRET_KEY`` with the following Python code: .. code-block:: python diff --git a/patchwork/settings/base.py b/patchwork/settings/base.py index 4b0d551..ec34f90 100644 --- a/patchwork/settings/base.py +++ b/patchwork/settings/base.py @@ -42,7 +42,7 @@ if django.VERSION >= (1, 10): else: MIDDLEWARE_CLASSES = _MIDDLEWARE_CLASSES -TIME_ZONE = 'Australia/Canberra' +TIME_ZONE = 'UTC' LANGUAGE_CODE = 'en-au' diff --git a/patchwork/templates/patchwork/submission.html b/patchwork/templates/patchwork/submission.html index 6ed20c3..e817713 100644 --- a/patchwork/templates/patchwork/submission.html +++ b/patchwork/templates/patchwork/submission.html @@ -255,7 +255,7 @@ function toggle_div(link_id, headers_id)
{{ submission.submitter|personify:project }} - {{ submission.date }} + {{ submission.date }} UTC
 {{ submission|commentsyntax }}
@@ -271,7 +271,7 @@ function toggle_div(link_id, headers_id)
 
{{ item.submitter|personify:project }} - {{ item.date }} | {{ item.date }} UTC | #{{ forloop.counter }}
diff --git a/releasenotes/notes/unify-timezones-0f7022f0c2a371be.yaml b/releasenotes/notes/unify-timezones-0f7022f0c2a371be.yaml
new file mode 100644
index 0000000..2513650
--- /dev/null
+++ b/releasenotes/notes/unify-timezones-0f7022f0c2a371be.yaml
@@ -0,0 +1,5 @@
+---
+other:
+  - |
+    Unify timezones used -- use UTC for both email submissions and internal
+    events.