55import os
66import re
77import tarfile
8+ import pytz
89
910from tempfile import mkstemp
1011
@@ -428,7 +429,6 @@ def get_meeting (num=None):
428429 return meeting
429430
430431def 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
439439def 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
460475def csv_agenda (request , num = None ):
0 commit comments