From b8c20439c091aaa56e772441e6c3a7e57e8ef2d4 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 23 Mar 2012 18:29:42 -0500 Subject: Change Django urls.py import Until Django 1.3, the functions include(), patterns() and url() plus handler404, handler500 were located in a django.conf.urls.defaults module. In Django 1.4, they live in django.conf.urls. Signed-off-by: Dan McGee --- releng/urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'releng') diff --git a/releng/urls.py b/releng/urls.py index 239ad02..8d1b8f2 100644 --- a/releng/urls.py +++ b/releng/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls.defaults import include, patterns +from django.conf.urls import include, patterns feedback_patterns = patterns('releng.views', (r'^$', 'test_results_overview', {}, 'releng-test-overview'), -- cgit v1.2.3-24-g4f1b 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 --- releng/management/commands/syncisos.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'releng') diff --git a/releng/management/commands/syncisos.py b/releng/management/commands/syncisos.py index 270c6c3..62f005f 100644 --- a/releng/management/commands/syncisos.py +++ b/releng/management/commands/syncisos.py @@ -1,4 +1,3 @@ -from datetime import datetime import re import urllib from HTMLParser import HTMLParser, HTMLParseError @@ -6,8 +5,10 @@ from HTMLParser import HTMLParser, HTMLParseError from django.conf import settings from django.core.management.base import BaseCommand, CommandError +from main.utils import utc_now from releng.models import Iso + class IsoListParser(HTMLParser): def __init__(self): HTMLParser.__init__(self) @@ -53,7 +54,7 @@ class Command(BaseCommand): existing.active = True existing.removed = None existing.save() - now = datetime.utcnow() + now = utc_now() # and then mark all other names as no longer active Iso.objects.filter(active=True).exclude(name__in=active_isos).update( active=False, removed=now) -- cgit v1.2.3-24-g4f1b