From 72a19e2ab2c4005206f90aefc9d19c0e056290b1 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Fri, 27 Sep 2013 20:07:42 +0000 Subject: [PATCH] Fixed the on-and-off failing test_agenda83txt(), which gave inconsistent results because the datetime object given to the template to render had no timezone setting. Added a PRODUCTION_TIMEZONE setting, and used it to provide a consistent timezone to the agenda.txt template. - Legacy-Id: 6292 --- ietf/meeting/proxy.py | 8 +++++++- ietf/settings.py | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ietf/meeting/proxy.py b/ietf/meeting/proxy.py index 4d84620b5..05bca8155 100644 --- a/ietf/meeting/proxy.py +++ b/ietf/meeting/proxy.py @@ -5,6 +5,8 @@ from django.conf import settings from ietf.utils.proxy import TranslatingManager from models import * +import debug + class MeetingProxy(Meeting): objects = TranslatingManager(dict(meeting_num="number"), always_filter=dict(type="ietf")) @@ -113,8 +115,12 @@ class SwitchesProxy(Meeting): #updated_time = models.TimeField(null=True, blank=True) def updated(self): from django.db.models import Max - return max(self.timeslot_set.aggregate(Max('modified'))["modified__max"], + import pytz + ts = max(self.timeslot_set.aggregate(Max('modified'))["modified__max"], self.session_set.aggregate(Max('modified'))["modified__max"]) + tz = pytz.timezone(settings.PRODUCTION_TIMEZONE) + ts = tz.localize(ts) + return ts class Meta: proxy = True diff --git a/ietf/settings.py b/ietf/settings.py index 32327f3b0..7ec0666bb 100644 --- a/ietf/settings.py +++ b/ietf/settings.py @@ -386,6 +386,8 @@ SECR_STATIC_URL = '/secretariat/' USE_ETAGS=True +PRODUCTION_TIMEZONE = "America/Los_Angeles" + # Put SECRET_KEY in here, or any other sensitive or site-specific # changes. DO NOT commit settings_local.py to svn. from settings_local import *