1.1 --- a/imip_manager.py Tue Feb 03 17:43:44 2015 +0100
1.2 +++ b/imip_manager.py Tue Feb 03 18:19:59 2015 +0100
1.3 @@ -286,6 +286,10 @@
1.4 self.preferences = Preferences(self.user)
1.5 return self.preferences
1.6
1.7 + def get_tzid(self):
1.8 + prefs = self.get_preferences()
1.9 + return prefs.get("TZID", "UTC")
1.10 +
1.11 # Prettyprinting of dates and times.
1.12
1.13 def format_date(self, dt, format):
1.14 @@ -387,8 +391,7 @@
1.15
1.16 # Obtain the user's timezone.
1.17
1.18 - prefs = self.get_preferences()
1.19 - tzid = prefs.get("TZID", "UTC")
1.20 + tzid = self.get_tzid()
1.21
1.22 # Invent a unique identifier.
1.23
1.24 @@ -558,8 +561,7 @@
1.25
1.26 # Obtain the user's timezone.
1.27
1.28 - prefs = self.get_preferences()
1.29 - tzid = prefs.get("TZID", "UTC")
1.30 + tzid = self.get_tzid()
1.31
1.32 # Provide a summary of the object.
1.33
1.34 @@ -803,8 +805,7 @@
1.35
1.36 # Obtain the user's timezone.
1.37
1.38 - prefs = self.get_preferences()
1.39 - tzid = prefs.get("TZID", "UTC")
1.40 + tzid = self.get_tzid()
1.41
1.42 # Day view: start at the earliest known day and produce days until the
1.43 # latest known day, perhaps with expandable sections of empty days.
1.44 @@ -851,7 +852,7 @@
1.45
1.46 # Add start of day time points for multi-day periods.
1.47
1.48 - add_day_start_points(slots)
1.49 + add_day_start_points(slots, tzid)
1.50
1.51 # Record the slots and all time points employed.
1.52
1.53 @@ -1026,13 +1027,17 @@
1.54
1.55 page = self.page
1.56
1.57 + # Obtain the user's timezone.
1.58 +
1.59 + tzid = self.get_tzid()
1.60 +
1.61 # Produce a row for each interval.
1.62
1.63 intervals = list(intervals)
1.64 intervals.sort()
1.65
1.66 for point, endpoint in intervals:
1.67 - continuation = point == get_start_of_day(point)
1.68 + continuation = point == get_start_of_day(point, tzid)
1.69
1.70 # Some rows contain no period details and are marked as such.
1.71
1.72 @@ -1081,7 +1086,7 @@
1.73 if point == start or continuation:
1.74
1.75 has_continued = continuation and point != start
1.76 - will_continue = not ends_on_same_day(point, end)
1.77 + will_continue = not ends_on_same_day(point, end, tzid)
1.78 css = " ".join(
1.79 ["event"] +
1.80 (has_continued and ["continued"] or []) +
1.81 @@ -1152,12 +1157,13 @@
1.82 """
1.83
1.84 page = self.page
1.85 + tzid = self.get_tzid()
1.86 daystr = format_datetime(point.date())
1.87 value, identifier = self._slot_value_and_identifier(point, endpoint)
1.88 slots = self.env.get_args().get("slot", [])
1.89 self._slot_selector(value, identifier, slots)
1.90 page.label(self.format_time(point, "long"), class_="timepoint day-%s" % daystr, for_=identifier)
1.91 - page.span(self.format_time(endpoint or get_end_of_day(point), "long"), class_="endpoint")
1.92 + page.span(self.format_time(endpoint or get_end_of_day(point, tzid), "long"), class_="endpoint")
1.93
1.94 def _slot_selector(self, value, identifier, slots):
1.95 page = self.page