summaryrefslogtreecommitdiffstats
path: root/packages/management
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-03-24 01:29:40 +0100
committerDan McGee <dan@archlinux.org>2012-03-24 01:54:40 +0100
commit90e08b4863dfaecafee5b151478bda4513b12e85 (patch)
treed25065edd39e1357ea0fd8b24ea86ce5630a8fb6 /packages/management
parentbc1ba4e95a3e572779eb8ba8a947e8d3ce165845 (diff)
downloadarchweb-90e08b4863dfaecafee5b151478bda4513b12e85.tar.gz
archweb-90e08b4863dfaecafee5b151478bda4513b12e85.tar.xz
Make all datetime objects fully timezone aware
This is most of the transition to Django 1.4 `USE_TZ = True`. We need to ensure we don't mix aware and non-aware datetime objects when dealing with datetimes in the code. Add a utc_now() helper method that we can use most places, and ensure there is always a timezone attached when necessary. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages/management')
-rw-r--r--packages/management/commands/signoff_report.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/management/commands/signoff_report.py b/packages/management/commands/signoff_report.py
index 3b67f51..ddf930d 100644
--- a/packages/management/commands/signoff_report.py
+++ b/packages/management/commands/signoff_report.py
@@ -17,12 +17,13 @@ from django.db.models import Count
from django.template import loader, Context
from collections import namedtuple
-from datetime import datetime, timedelta
+from datetime import timedelta
import logging
from operator import attrgetter
import sys
from main.models import Repo
+from main.utils import utc_now
from packages.models import Signoff
from packages.utils import get_signoff_groups
@@ -65,7 +66,7 @@ def generate_report(email, repo_name):
new_hours = 24
old_days = 14
- now = datetime.utcnow()
+ now = utc_now()
new_cutoff = now - timedelta(hours=new_hours)
old_cutoff = now - timedelta(days=old_days)