From 90e08b4863dfaecafee5b151478bda4513b12e85 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 23 Mar 2012 19:29:40 -0500 Subject: 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 --- packages/management/commands/signoff_report.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'packages/management/commands') diff --git a/packages/management/commands/signoff_report.py b/packages/management/commands/signoff_report.py index 3b67f518..ddf930db 100644 --- a/packages/management/commands/signoff_report.py +++ b/packages/management/commands/signoff_report.py @@ -17,12 +17,13 @@ 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) -- cgit v1.2.3-54-g00ecf