Skip to content

Commit 484eb75

Browse files
committed
Merged [4226] from adam@nostrum.com:
Updated agenda.ics to use new data model. Also, tons more efficient. Additionally, the description field now includes links to relevant meeting materials. - Legacy-Id: 4267 Note: SVN reference [4226] has been migrated to Git commit 740487d
2 parents 257f677 + 740487d commit 484eb75

3 files changed

Lines changed: 46 additions & 36 deletions

File tree

ietf/meeting/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def time_zone_offset(self):
4747
# Look at the time of 8 o'clock sunday, rather than 0h sunday, to get
4848
# the right time after a possible summer/winter time change.
4949
return pytz.timezone(self.time_zone).localize(datetime.datetime.combine(self.date, datetime.time(8, 0))).strftime("%z")
50+
5051
def get_meeting_date (self,offset):
5152
return self.date + datetime.timedelta(days=offset)
5253

ietf/meeting/views.py

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import os
66
import re
77
import tarfile
8+
import pytz
89

910
from tempfile import mkstemp
1011

@@ -428,7 +429,6 @@ def get_meeting (num=None):
428429
return meeting
429430

430431
def week_view(request, num=None):
431-
#timeslots, update, meeting, venue, ads, plenaryw_agenda, plenaryt_agenda = agenda_info(num)
432432
meeting = get_meeting(num)
433433
timeslots = TimeSlot.objects.filter(meeting = meeting.number)
434434

@@ -437,24 +437,39 @@ def week_view(request, num=None):
437437
{"timeslots":timeslots,"render_types":["Session","Other","Break","Plenary"]}, context_instance=RequestContext(request))
438438

439439
def ical_agenda(request, num=None):
440-
timeslots, update, meeting, venue, ads, plenaryw_agenda, plenaryt_agenda = agenda_info(num)
441-
wgs = IETFWG.objects.filter(status=IETFWG.ACTIVE).order_by('group_acronym__acronym')
442-
rgs = IRTF.objects.all().order_by('acronym')
443-
areas = Area.objects.filter(status=Area.ACTIVE).order_by('area_acronym__acronym')
440+
# The timezone situation here remains tragic, but I've burned
441+
# hours trying to figure out how to get the information I need
442+
# in python. I can do this trivially in perl with its Ical module,
443+
# but the icalendar module in python seems staggeringly less
444+
# capable. There might be a path to success here, but I'm not
445+
# completely convinced. So I'm going to spend some time
446+
# working on more urgent matters for now. -Adam
447+
448+
meeting = get_meeting(num)
449+
444450
q = request.META.get('QUERY_STRING','') or ""
445451
filter = q.lower().split(',');
446452
include = set(filter)
447-
now = datetime.datetime.utcnow()
448-
449-
for slot in timeslots:
450-
for session in slot.sessions():
451-
if session.area() == '' or session.area().find('plenary') > 0 or (session.area().lower() in include):
452-
filter.append(session.acronym())
453+
include_types = ["Plenary","Other"]
454+
exclude = []
455+
456+
# Process the special flags.
457+
for item in include:
458+
if item[0] == '-':
459+
exclude.append(item[1:])
460+
if item[0] == '~':
461+
include_types.append(item[1:2].upper()+item[2:])
462+
463+
timeslots = TimeSlot.objects.filter(Q(meeting = meeting.number),
464+
Q(type__name__in = include_types) |
465+
Q(session__group__acronym__in = filter) |
466+
Q(session__group__parent__acronym__in = filter)
467+
).exclude(Q(session__group__isnull = False),
468+
Q(session__group__acronym__in = exclude) |
469+
Q(session__group__parent__acronym__in = exclude))
453470

454471
return HttpResponse(render_to_string("meeting/agendaREDESIGN.ics" if settings.USE_DB_REDESIGN_PROXY_CLASSES else "meeting/agenda.ics",
455-
{"filter":set(filter), "timeslots":timeslots, "update":update, "meeting":meeting, "venue":venue, "ads":ads,
456-
"plenaryw_agenda":plenaryw_agenda, "plenaryt_agenda":plenaryt_agenda,
457-
"now":now},
472+
{"timeslots":timeslots, "meeting":meeting },
458473
RequestContext(request)), mimetype="text/calendar")
459474

460475
def csv_agenda(request, num=None):

ietf/templates/meeting/agendaREDESIGN.ics

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,21 @@ TZOFFSETTO:{{meeting.time_zone_offset}}
99
TZNAME:{{meeting.time_zone}}
1010
DTSTART:19700101T000000
1111
END:STANDARD
12-
END:VTIMEZONE
13-
{% endif %}{% for slot in timeslots %}{% ifchanged %}{% if slot.session_name and slot.break_info %}BEGIN:VEVENT
14-
UID:ietf-{{meeting.num}}-break-{{slot.time_id}}
15-
SUMMARY:{{slot.break_info.name}}
16-
{% if venue.break_area_name and slot.break_info.show_break_location %}LOCATION:{{venue.break_area_name}}
12+
END:VTIMEZONE{% endif %}{% for slot in timeslots %}
13+
BEGIN:VEVENT
14+
UID:ietf-{{slot.meeting.number}}-{{slot.pk}}
15+
SUMMARY:{% if slot.session.name %}{{slot.session.name}}{% else %}{% if slot.type.name == "Break" %}{{slot.name}}{% else %}{{slot.session.group.acronym|upper}} - {{slot.session.group.name}}{% endif%}{%endif%}
16+
{% if slot.show_location %}LOCATION:{{slot.get_location}}
1717
{% endif %}STATUS:TENTATIVE
1818
CLASS:PUBLIC
19-
DTSTART{% if meeting.time_zone %};TZID="{{meeting.time_zone}}"{%endif%}:{{ slot.meeting_date|date:"Ymd" }}T{{slot.break_info.time_desc|slice:":4"}}00
20-
DTEND{% if meeting.time_zone %};TZID="{{meeting.time_zone}}"{%endif%}:{{ slot.meeting_date|date:"Ymd" }}T{{slot.break_info.time_desc|slice:"5:9"}}00
21-
DTSTAMP:{{ now|date:"Ymd" }}T{{ now|date:"His" }}Z
22-
END:VEVENT
23-
{% endif %}{% endifchanged %}{% for session in slot.sessions %}{%for f in filter%}{%ifequal f session.acronym%}BEGIN:VEVENT
24-
UID:ietf-{{meeting.num}}-{{session.acronym}}-{{session.pk}}
25-
SUMMARY:{% if session.area %}{% ifnotequal session.area "1plenary" %}{{session.acronym|upper}} - {% endifnotequal %}{% endif %}{{session.acronym_name}}
26-
LOCATION:{{session.room_id.room_name}}
27-
STATUS:TENTATIVE
28-
CLASS:PUBLIC
29-
DTSTART{% if meeting.time_zone %};TZID="{{meeting.time_zone}}"{%endif%}:{{ slot.meeting_date|date:"Ymd" }}T{{slot.time_desc|slice:":4"}}00
30-
DTEND{% if meeting.time_zone %};TZID="{{meeting.time_zone}}"{%endif%}:{{ slot.meeting_date|date:"Ymd" }}T{{slot.time_desc|slice:"5:9"}}00
31-
DTSTAMP:{{ now|date:"Ymd" }}T{{ now|date:"His" }}Z
32-
{% if session.description %}DESCRIPTION:
33-
{{ session.description|escapejs }}
34-
{% endif %}END:VEVENT
35-
{%endifequal%}{%endfor%}{% endfor %}{% endfor %}END:VCALENDAR{% endautoescape %}
19+
DTSTART{% if meeting.time_zone %};TZID="{{meeting.time_zone}}"{%endif%}:{{ slot.time|date:"Ymd" }}T{{slot.time|date:"Hi"}}00
20+
DTEND{% if meeting.time_zone %};TZID="{{meeting.time_zone}}"{%endif%}:{{ slot.end_time|date:"Ymd" }}T{{slot.end_time|date:"Hi"}}00
21+
DTSTAMP:{{ slot.modified|date:"Ymd" }}T{{ slot.modified|date:"His" }}Z
22+
{% if slot.session.agenda %}URL:http://www.ietf.org{{slot.session.agenda.get_absolute_url}}
23+
DESCRIPTION:{{slot.name}}\n{% if slot.session.agenda_note %}
24+
Note: {{slot.session.agenda_note}}\n{% endif %}{% for material in slot.session.materials.all %}
25+
\n{{material.type}}{% if material.type.name != "Agenda" %}
26+
({{material.title}}){% endif %}:
27+
http://www.ietf.org{{material.get_absolute_url}}\n{% endfor %}
28+
{% endif %}END:VEVENT{% endfor %}
29+
END:VCALENDAR{% endautoescape %}

0 commit comments

Comments
 (0)