From 9e1ff8adb7c8c51eb863f40f4f40a98377640245 Mon Sep 17 00:00:00 2001 From: Corentin Chary Date: Mon, 23 Apr 2012 17:05:46 +0200 Subject: [PATCH] euscanwww: use tz aware datetimes Signed-off-by: Corentin Chary --- euscanwww/djeuscan/management/commands/scan-metadata.py | 2 +- euscanwww/djeuscan/management/commands/scan-upstream.py | 3 ++- euscanwww/djeuscan/management/commands/update-counters.py | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/euscanwww/djeuscan/management/commands/scan-metadata.py b/euscanwww/djeuscan/management/commands/scan-metadata.py index da9f26e..983f2d7 100644 --- a/euscanwww/djeuscan/management/commands/scan-metadata.py +++ b/euscanwww/djeuscan/management/commands/scan-metadata.py @@ -88,7 +88,7 @@ class Command(BaseCommand): old_maintainers = set(existing_maintainers).difference(maintainers.keys()) for herd in obj.herds.all(): - if herd.email in old_herds: + if herd.herd in old_herds: obj.herds.remove(herd) for herd in new_herds: diff --git a/euscanwww/djeuscan/management/commands/scan-upstream.py b/euscanwww/djeuscan/management/commands/scan-upstream.py index 4469f38..1c79f3f 100644 --- a/euscanwww/djeuscan/management/commands/scan-upstream.py +++ b/euscanwww/djeuscan/management/commands/scan-upstream.py @@ -9,6 +9,7 @@ from datetime import datetime from portage import versions from optparse import make_option +from django.utils import timezone from django.db.transaction import commit_on_success from django.core.management.base import BaseCommand, CommandError from djeuscan.models import Package, Version, EuscanResult, VersionLog @@ -120,7 +121,7 @@ class Command(BaseCommand): obj = EuscanResult() obj.package = package obj.result = log - obj.datetime = datetime.now() + obj.datetime = timezone.now() obj.save() diff --git a/euscanwww/djeuscan/management/commands/update-counters.py b/euscanwww/djeuscan/management/commands/update-counters.py index 65a6179..fc29845 100644 --- a/euscanwww/djeuscan/management/commands/update-counters.py +++ b/euscanwww/djeuscan/management/commands/update-counters.py @@ -5,6 +5,7 @@ from optparse import make_option from django.db.models import Count, Sum from django.db.transaction import commit_on_success from django.core.management.base import BaseCommand, CommandError +from django.utils import timezone from djeuscan.models import Package, Herd, Maintainer, Version from djeuscan.models import HerdLog, MaintainerLog, CategoryLog, WorldLog @@ -44,7 +45,7 @@ class Command(BaseCommand): @commit_on_success def handle(self, *args, **options): - now = datetime.datetime.now() + now = timezone.now() categories = {} herds = {}