Repository: ietf-tools/datatracker

Issue:
The meeting text agenda page is now only in unlabelled UTC
/meeting/agenda.txt should probably render in meeting local time.
We should probably make
/meeting/agenda-utc.txt work again.
In any case, the resulting text should be explicit about what timezone it is being displayed in.

(Right now, it displays in UTC with a "Last changed at" at the top of the page in meeting local time...)


Discussion:

Resolving patch:
diff --git a/ietf/meeting/models.py b/ietf/meeting/models.py
--- a/ietf/meeting/models.py
+++ b/ietf/meeting/models.py
@@ -602,10 +602,6 @@ def session(self):
             self._session_cache = self.sessions.filter(timeslotassignments__schedule__in=[self.meeting.schedule, self.meeting.schedule.base if self.meeting else None]).first()
         return self._session_cache
 
-    @property
-    def time_desc(self):
-        return "%s-%s" % (self.time.strftime("%H%M"), (self.time + self.duration).strftime("%H%M"))
-
     def meeting_date(self):
         return self.time.date()
 
diff --git a/ietf/meeting/urls.py b/ietf/meeting/urls.py
--- a/ietf/meeting/urls.py
+++ b/ietf/meeting/urls.py
@@ -69,7 +69,7 @@ def get_redirect_url(self, *args, **kwargs):
 
 type_ietf_only_patterns_id_optional = [
     url(r'^agenda(?P<utc>-utc)?(?P<ext>\.html)?/?$', views.agenda, name='agenda'),
-    url(r'^agenda(?P<ext>\.txt)$', views.agenda_plain),
+    url(r'^agenda(?P<utc>-utc)?(?P<ext>\.txt)$', views.agenda_plain),
     url(r'^agenda(?P<ext>\.csv)$', views.agenda_plain),
     url(r'^agenda/edit$',
         RedirectView.as_view(pattern_name='ietf.meeting.views.edit_meeting_schedule', permanent=True),
diff --git a/ietf/meeting/views.py b/ietf/meeting/views.py
--- a/ietf/meeting/views.py
+++ b/ietf/meeting/views.py
@@ -1521,7 +1521,7 @@ def get_assignments_for_agenda(schedule):
 
 
 @ensure_csrf_cookie
-def agenda_plain(request, num=None, name=None, base=None, ext=None, owner=None, utc=""):
+def agenda_plain(request, num=None, name=None, base=None, ext=None, owner=None, utc=None):
     base = base if base else 'agenda'
     ext = ext if ext else '.txt'
     mimetype = {
@@ -1571,7 +1571,7 @@ def agenda_plain(request, num=None, name=None, base=None, ext=None, owner=None,
 
     is_current_meeting = (num is None) or (num == get_current_ietf_meeting_num())
 
-    display_timezone = 'UTC' if utc else meeting.time_zone
+    display_timezone = meeting.time_zone if utc is None else 'UTC'
     with timezone.override(display_timezone):
         rendered_page = render(
             request,


Test patch:
diff --git a/ietf/meeting/tests_views.py b/ietf/meeting/tests_views.py
--- a/ietf/meeting/tests_views.py
+++ b/ietf/meeting/tests_views.py
@@ -228,9 +228,6 @@ def test_meeting_agenda(self):
 
         registration_text = "Registration"
 
-        # utc
-        time_interval = r"%s<span.*/span>-%s" % (slot.utc_start_time().strftime("%H:%M").lstrip("0"), (slot.utc_start_time() + slot.duration).strftime("%H:%M").lstrip("0"))
-
         # Extremely rudementary test of agenda-neue - to be replaced with back-end tests as the front-end tests are developed.
         r = self.client.get(urlreverse("agenda", kwargs=dict(num=meeting.number,utc='-utc')))
         self.assertEqual(r.status_code, 200)  
@@ -279,23 +276,32 @@ def test_meeting_agenda(self):
             }
         )
 
-        # plain
-        time_interval = r"{}<span.*/span>-{}".format(
-            slot.time.astimezone(meeting.tz()).strftime("%H:%M").lstrip("0"),
-            slot.end_time().astimezone(meeting.tz()).strftime("%H:%M").lstrip("0"),
-        )
-
         # text
-        # the rest of the results don't have as nicely formatted times
-        time_interval = "%s-%s" % (slot.time.strftime("%H%M").lstrip("0"), (slot.time + slot.duration).strftime("%H%M").lstrip("0"))
-
         r = self.client.get(urlreverse("ietf.meeting.views.agenda_plain", kwargs=dict(num=meeting.number, ext=".txt")))
         self.assertContains(r, session.group.acronym)
         self.assertContains(r, session.group.name)
         self.assertContains(r, session.group.parent.acronym.upper())
         self.assertContains(r, slot.location.name)
-
-        self.assertContains(r, time_interval)
+        self.assertContains(r, "{}-{}".format(
+            slot.time.astimezone(meeting.tz()).strftime("%H%M"),
+            (slot.time + slot.duration).astimezone(meeting.tz()).strftime("%H%M"),
+        ))
+        self.assertContains(r, f"shown in the {meeting.tz()} time zone")
+
+        # text, UTC
+        r = self.client.get(urlreverse(
+            "ietf.meeting.views.agenda_plain",
+            kwargs=dict(num=meeting.number, ext=".txt", utc="-utc"),
+        ))
+        self.assertContains(r, session.group.acronym)
+        self.assertContains(r, session.group.name)
+        self.assertContains(r, session.group.parent.acronym.upper())
+        self.assertContains(r, slot.location.name)
+        self.assertContains(r, "{}-{}".format(
+            slot.time.astimezone(datetime.timezone.utc).strftime("%H%M"),
+            (slot.time + slot.duration).astimezone(datetime.timezone.utc).strftime("%H%M"),
+        ))
+        self.assertContains(r, "shown in UTC")
 
         # future meeting, no agenda
         r = self.client.get(urlreverse("ietf.meeting.views.agenda_plain", kwargs=dict(num=future_meeting.number, ext=".txt")))