This is an automated email from the ASF dual-hosted git repository. maximebeauchemin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push: new a26e65f Create CsvResponse to manage csv exports encoding (#3484) a26e65f is described below commit a26e65f418e6d83e389b285eb3cdeb7df84afbed Author: JulieRossi <julieross...@gmail.com> AuthorDate: Mon Sep 18 18:51:13 2017 +0200 Create CsvResponse to manage csv exports encoding (#3484) --- superset/views/base.py | 7 +++++++ superset/views/core.py | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/superset/views/base.py b/superset/views/base.py index 02aaf8d..73627d0 100644 --- a/superset/views/base.py +++ b/superset/views/base.py @@ -336,3 +336,10 @@ class DatasourceFilter(SupersetFilter): perms = self.get_view_menus('datasource_access') # TODO(bogdan): add `schema_access` support here return query.filter(self.model.perm.in_(perms)) + + +class CsvResponse(Response): + """ + Override Response to take into account csv encoding from config.py + """ + charset = conf.get('CSV_EXPORT').get('encoding', 'utf-8') diff --git a/superset/views/core.py b/superset/views/core.py index 72d2cf6..faa61ad 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -43,8 +43,8 @@ from superset.sql_parse import SupersetQuery from .base import ( api, SupersetModelView, BaseSupersetView, DeleteMixin, - SupersetFilter, get_user_roles, json_error_response, get_error_msg -) + SupersetFilter, get_user_roles, json_error_response, get_error_msg, + CsvResponse) config = app.config stats_logger = config.get('STATS_LOGGER') @@ -959,7 +959,7 @@ class Superset(BaseSupersetView): return json_error_response(DATASOURCE_ACCESS_ERR, status=404) if request.args.get("csv") == "true": - return Response( + return CsvResponse( viz_obj.get_csv(), status=200, headers=generate_download_headers("csv"), -- To stop receiving notification emails like this one, please contact ['"comm...@superset.apache.org" <comm...@superset.apache.org>'].