Module: check_mk
Branch: master
Commit: c6689dbb5c29c9adf52cfa5e9e0ab09c6a020f3c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c6689dbb5c29c9…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Nov 13 10:58:00 2014 +0100
Fix import of iCal files, non-repeated dates were missing
---
web/htdocs/wato.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index aef5840..3e2db49 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -9351,6 +9351,7 @@ def parse_ical(ical_blob, horizon=10, times=(None, None, None)):
return t
# Now resolve recurring events starting from 01.01 of current year
+ # Non-recurring events are simply copied
resolved = []
now = list(time.strptime(str(time.localtime().tm_year-1), "%Y"))
last = now[:]
@@ -9367,8 +9368,14 @@ def parse_ical(ical_blob, horizon=10, times=(None, None, None)):
'name' : event['name'],
'date' : time.strftime('%Y-%m-%d', cur),
})
+ else:
+ resolved.append({
+ 'name' : event['name'],
+ 'date' : time.strftime('%Y-%m-%d',
event['start'])
+ })
ical['events'] = sorted(resolved)
+
return ical
# Displays a dialog for uploading an ical file which will then
@@ -9395,7 +9402,7 @@ def mode_timeperiod_import_ical(phase):
custom_validate = validate_ical_file,
)),
('horizon', Integer(
- title = _('Time Horizon'),
+ title = _('Time horizon for repeated events'),
help = _("When the iCalendar file contains definitions of repeating
events, these repeating "
"events will be resolved to single events for the number of
years you specify here."),
minvalue = 0,
@@ -9462,7 +9469,7 @@ def mode_timeperiod_import_ical(phase):
html.begin_form("import_ical", method="POST")
vs_ical.render_input("ical", ical)
forms.end()
- html.button("upload", _("Upload"))
+ html.button("upload", _("Import"))
html.hidden_fields()
html.end_form()