Skip to content

Commit 72a19e2

Browse files
committed
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
1 parent 19d4b17 commit 72a19e2

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

ietf/meeting/proxy.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from ietf.utils.proxy import TranslatingManager
66
from models import *
77

8+
import debug
9+
810
class MeetingProxy(Meeting):
911
objects = TranslatingManager(dict(meeting_num="number"), always_filter=dict(type="ietf"))
1012

@@ -113,8 +115,12 @@ def from_object(self, base):
113115
#updated_time = models.TimeField(null=True, blank=True)
114116
def updated(self):
115117
from django.db.models import Max
116-
return max(self.timeslot_set.aggregate(Max('modified'))["modified__max"],
118+
import pytz
119+
ts = max(self.timeslot_set.aggregate(Max('modified'))["modified__max"],
117120
self.session_set.aggregate(Max('modified'))["modified__max"])
121+
tz = pytz.timezone(settings.PRODUCTION_TIMEZONE)
122+
ts = tz.localize(ts)
123+
return ts
118124
class Meta:
119125
proxy = True
120126

ietf/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,8 @@
386386

387387
USE_ETAGS=True
388388

389+
PRODUCTION_TIMEZONE = "America/Los_Angeles"
390+
389391
# Put SECRET_KEY in here, or any other sensitive or site-specific
390392
# changes. DO NOT commit settings_local.py to svn.
391393
from settings_local import *

0 commit comments

Comments
 (0)