comparison libervia/web/pages/calendar/page_meta.py @ 1580:08342aca8c1e

pages: make `tz_data` always available as template data and exposed to scripts
author Goffi <goffi@goffi.org>
date Tue, 28 Nov 2023 17:52:09 +0100
parents eb00d593801d
children
comparison
equal deleted inserted replaced
1579:5db55d01ce05 1580:08342aca8c1e
33 log.warning(_("Can't get events list for {profile}: {reason}").format( 33 log.warning(_("Can't get events list for {profile}: {reason}").format(
34 profile=profile, reason=e)) 34 profile=profile, reason=e))
35 else: 35 else:
36 template_data["events"] = events 36 template_data["events"] = events
37 37
38 tz_name = template_data["tz_name"] = time.tzname[0]
39 local_tz = tz.tzlocal() 38 local_tz = tz.tzlocal()
40 today_local = datetime.datetime.now(local_tz).date() 39 today_local = datetime.datetime.now(local_tz).date()
41 calendar_start = template_data["calendar_start"] = datetime.datetime.combine( 40 calendar_start = template_data["calendar_start"] = datetime.datetime.combine(
42 today_local, datetime.time.min, tzinfo=local_tz 41 today_local, datetime.time.min, tzinfo=local_tz
43 ).timestamp() 42 ).timestamp()
46 ).timestamp() 45 ).timestamp()
47 self.expose_to_scripts( 46 self.expose_to_scripts(
48 request, 47 request,
49 calendar_start=calendar_start, 48 calendar_start=calendar_start,
50 calendar_end=calendar_end, 49 calendar_end=calendar_end,
51 tz_name=tz_name,
52 ) 50 )