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
This commit is contained in:
Henrik Levkowetz 2013-09-27 20:07:42 +00:00
parent 19d4b17e53
commit 72a19e2ab2
2 changed files with 9 additions and 1 deletions

View file

@ -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

View file

@ -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 *