1.1 --- a/imipweb/calendar.py Sat Mar 28 00:52:14 2015 +0100
1.2 +++ b/imipweb/calendar.py Sat Mar 28 00:55:12 2015 +0100
1.3 @@ -26,9 +26,8 @@
1.4 get_start_of_next_day, get_timestamp, ends_on_same_day, \
1.5 to_timezone
1.6 from imiptools.period import add_day_start_points, add_empty_days, add_slots, \
1.7 - convert_periods, get_freebusy_details, \
1.8 - get_scale, get_slots, get_spans, partition_by_day, \
1.9 - Point
1.10 + convert_periods, get_scale, get_slots, get_spans, \
1.11 + partition_by_day, Point
1.12 from imipweb.resource import Resource
1.13
1.14 class CalendarPage(Resource):
1.15 @@ -318,7 +317,7 @@
1.16 # Obtain time point information for each group of periods.
1.17
1.18 for periods in period_groups:
1.19 - periods = convert_periods(periods, tzid)
1.20 + convert_periods(periods, tzid)
1.21
1.22 # Get the time scale with start and end points.
1.23
1.24 @@ -599,8 +598,11 @@
1.25
1.26 # Show a column for each active period.
1.27
1.28 - for t in active:
1.29 - if t and len(t) >= 2:
1.30 + for p in active:
1.31 +
1.32 + # The period can be None, meaning an empty column.
1.33 +
1.34 + if p:
1.35
1.36 # Flush empty slots preceding this one.
1.37
1.38 @@ -608,7 +610,7 @@
1.39 self._empty_slot(point, endpoint, empty)
1.40 empty = 0
1.41
1.42 - start, end, uid, recurrenceid, summary, organiser, key = get_freebusy_details(t)
1.43 + key = p.get_key()
1.44 span = spans[key]
1.45
1.46 # Produce a table cell only at the start of the period
1.47 @@ -616,11 +618,11 @@
1.48 # Points defining the ends of instant events should
1.49 # never define the start of new events.
1.50
1.51 - if point.indicator == Point.PRINCIPAL and (point.point == start or continuation):
1.52 + if point.indicator == Point.PRINCIPAL and (point.point == p.start or continuation):
1.53
1.54 - has_continued = continuation and point.point != start
1.55 - will_continue = not ends_on_same_day(point.point, end, tzid)
1.56 - is_organiser = organiser == self.user
1.57 + has_continued = continuation and point.point != p.start
1.58 + will_continue = not ends_on_same_day(point.point, p.end, tzid)
1.59 + is_organiser = p.organiser == self.user
1.60
1.61 css = " ".join([
1.62 "event",
1.63 @@ -633,9 +635,9 @@
1.64 # Need to only anchor the first period for a recurring
1.65 # event.
1.66
1.67 - html_id = "%s-%s-%s" % (group_type, uid, recurrenceid or "")
1.68 + html_id = "%s-%s-%s" % (group_type, p.uid, p.recurrenceid or "")
1.69
1.70 - if point.point == start and html_id not in self.html_ids:
1.71 + if point.point == p.start and html_id not in self.html_ids:
1.72 page.td(class_=css, rowspan=span, id=html_id)
1.73 self.html_ids.add(html_id)
1.74 else:
1.75 @@ -644,10 +646,10 @@
1.76 # Only link to events if they are not being
1.77 # updated by requests.
1.78
1.79 - if not summary or (uid, recurrenceid) in self._get_requests() and group_type != "request":
1.80 - page.span(summary or "(Participant is busy)")
1.81 + if not p.summary or (p.uid, p.recurrenceid) in self._get_requests() and group_type != "request":
1.82 + page.span(p.summary or "(Participant is busy)")
1.83 else:
1.84 - page.a(summary, href=self.link_to(uid, recurrenceid))
1.85 + page.a(p.summary, href=self.link_to(p.uid, p.recurrenceid))
1.86
1.87 page.td.close()
1.88 else: