Module: check_mk
Branch: master
Commit: 1bafa660646ccf39809c930b84e9d933f2d81760
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1bafa660646ccf…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jul 3 14:48:43 2017 +0200
4932 FIX Timeperiod iCalendar import: Fixed broken import of full day entries
Change-Id: I233cc1bde1f67f9505176b4cf1741b1613cefca2
---
.werks/4932 | 11 +++++++++++
web/htdocs/wato.py | 17 ++++++++++-------
2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/.werks/4932 b/.werks/4932
new file mode 100644
index 0000000..20126a5
--- /dev/null
+++ b/.werks/4932
@@ -0,0 +1,11 @@
+Title: Timeperiod iCalendar import: Fixed broken import of full day entries
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1499086053
+
+
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index f3dc7ae..621169a 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -8866,7 +8866,7 @@ def validate_ical_file(value, varprefix):
#
http://tools.ietf.org/html/rfc5545
# TODO: Let's use some sort of standard module in the future. Maybe we can then also
handle
# times instead of only full day events.
-def parse_ical(ical_blob, horizon=10, times=(None, None, None)):
+def parse_ical(ical_blob, horizon=10):
ical = {'raw_events': []}
def get_params(key):
@@ -9042,7 +9042,7 @@ def mode_timeperiod_import_ical(phase):
filename, ty, content = ical['file']
try:
- data = parse_ical(content, ical['horizon'],
ical['times'])
+ data = parse_ical(content, ical['horizon'])
except Exception, e:
if config.debug:
raise
@@ -9060,11 +9060,14 @@ def mode_timeperiod_import_ical(phase):
index += 1
html.set_var('except_%d_0' % index, event['date'])
html.set_var('except_indexof_%d' % index, "%d" %
index)
- for n, time_spec in enumerate(ical["times"]):
- start_time = ":".join(map(str, time_spec[0]))
- end_time = ":".join(map(str, time_spec[1]))
- html.set_var('except_%d_1_%d_from' % (index, n), start_time)
- html.set_var('except_%d_1_%d_until' % (index, n), end_time)
+
+ if ical["times"]:
+ for n, time_spec in enumerate(ical["times"]):
+ start_time = ":".join(map(lambda x: "%02d" %
x, time_spec[0]))
+ end_time = ":".join(map(lambda x: "%02d" %
x, time_spec[1]))
+ html.set_var('except_%d_1_%d_from' % (index, n),
start_time)
+ html.set_var('except_%d_1_%d_until' % (index, n),
end_time)
+
return "edit_timeperiod"
return