Module: check_mk
Branch: master
Commit: 49b5ce3152a5e1da6f9ccb331c393bc5c495d5fb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=49b5ce3152a5e1…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Mar 27 17:07:00 2014 +0100
FIX csv_export: now able to handle umlauts in download filenames
The csv export function raised an exception when the
type of the filename was set to unicode. This happened when
the filename text contained umlauts.
Filenames are now converted to utf-8 in this case.
---
.werks/738 | 11 +++++++++++
ChangeLog | 1 +
web/plugins/views/availability.py | 2 ++
web/plugins/views/webservice.py | 4 ++++
4 files changed, 18 insertions(+)
diff --git a/.werks/738 b/.werks/738
new file mode 100644
index 0000000..4c3ee4a
--- /dev/null
+++ b/.werks/738
@@ -0,0 +1,11 @@
+Title: csv_export: now able to handle umlauts in download filenames
+Level: 1
+Component: multisite
+Version: 1.2.5i1
+Date: 1395936272
+Class: fix
+
+The csv export function raised an exception when the
+type of the filename was set to unicode. This happened when
+the filename text contained umlauts.
+Filenames are now converted to utf-8 in this case.
diff --git a/ChangeLog b/ChangeLog
index ea5f2fb..7e22dec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -285,6 +285,7 @@
* 0671 FIX: LDAP: Disable logging of password changes received from LDAP
* 0558 FIX: availability: fixed exception on specific filter settings...
* 0712 FIX: Fix multiple groups with same tag when grouping hosts after a tag...
+ * 0738 FIX: csv_export: now able to handle umlauts in download filenames...
WATO:
* 0308 Multisite can now set rotation view permissions for NagVis...
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index 907a460..435f4f6 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -62,6 +62,8 @@ def render_availability(view, datasource, filterheaders,
display_options,
do_csv = True
html.req.content_type = "text/csv; charset=UTF-8"
filename = '%s-%s.csv' % (title,
time.strftime('%Y-%m-%d_%H-%M-%S', time.localtime(time.time())))
+ if type(filename) == unicode:
+ filename = filename.encode("utf-8")
html.req.headers_out['Content-Disposition'] = 'Attachment;
filename=%s' % filename
else:
do_csv = False
diff --git a/web/plugins/views/webservice.py b/web/plugins/views/webservice.py
index cbc9a1d..c32e88b 100644
--- a/web/plugins/views/webservice.py
+++ b/web/plugins/views/webservice.py
@@ -67,6 +67,8 @@ def render_json(rows, view, group_painters, painters, num_columns,
show_checkbox
if export:
html.req.content_type = "appliation/json; charset=UTF-8"
filename = '%s-%s.json' % (view['name'],
time.strftime('%Y-%m-%d_%H-%M-%S', time.localtime(time.time())))
+ if type(filename) == unicode:
+ filename = filename.encode("utf-8")
html.req.headers_out['Content-Disposition'] = 'Attachment;
filename=%s' % filename
html.write("[\n")
@@ -124,6 +126,8 @@ def render_csv(rows, view, group_painters, painters, num_columns,
show_checkboxe
if export:
html.req.content_type = "text/csv; charset=UTF-8"
filename = '%s-%s.csv' % (view['name'],
time.strftime('%Y-%m-%d_%H-%M-%S', time.localtime(time.time())))
+ if type(filename) == unicode:
+ filename = filename.encode("utf-8")
html.req.headers_out['Content-Disposition'] = 'Attachment;
filename=%s' % filename
csv_separator = html.var("csv_separator", ";")