diff options
author | Veronika Kabatova <vkabatov@redhat.com> | 2018-02-22 16:24:46 +0100 |
---|---|---|
committer | Daniel Axtens <dja@axtens.net> | 2018-03-08 01:28:11 +1100 |
commit | 8465e33c23310e4873d464fe2581842df2e9c6f8 (patch) | |
tree | dc5c933f797f0548143ffecf9c1b9dfbacba6dfc /patchwork/notifications.py | |
parent | 5e0e06db42ffd62a7258448ea21e4a5ca5e7430b (diff) | |
download | patchwork-8465e33c23310e4873d464fe2581842df2e9c6f8.tar patchwork-8465e33c23310e4873d464fe2581842df2e9c6f8.tar.gz |
Avoid timezone confusion
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 <vkabatov@redhat.com>
[dja:
- squash 2 patches: https://patchwork.ozlabs.org/patch/876744/
https://patchwork.ozlabs.org/patch/877815/
- minor changes to both patches - rejig order of migrations and
adjust wording: "happened sooner" -> "happened earlier"]
Tested-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Daniel Axtens <dja@axtens.net>
Diffstat (limited to 'patchwork/notifications.py')
-rw-r--r-- | patchwork/notifications.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/patchwork/notifications.py b/patchwork/notifications.py index 88e9662..a5f6423 100644 --- a/patchwork/notifications.py +++ b/patchwork/notifications.py @@ -35,7 +35,7 @@ from patchwork.models import PatchChangeNotification def send_notifications(): - date_limit = datetime.datetime.now() - datetime.timedelta( + date_limit = datetime.datetime.utcnow() - datetime.timedelta( minutes=settings.NOTIFICATION_DELAY_MINUTES) # We delay sending notifications to a user if they have other @@ -104,7 +104,7 @@ def expire_notifications(): Users whose registration confirmation has expired are removed. """ # expire any invalid confirmations - q = (Q(date__lt=datetime.datetime.now() - EmailConfirmation.validity) | + q = (Q(date__lt=datetime.datetime.utcnow() - EmailConfirmation.validity) | Q(active=False)) EmailConfirmation.objects.filter(q).delete() |