Ensure that users can use custom characters as CSV field separators/CSV quotes when downloading query results. #5066

This commit is contained in:
Nikhil Mohite
2022-10-20 16:28:42 +05:30
committed by GitHub
parent 4925c6ce50
commit abfc30db8b
2 changed files with 11 additions and 3 deletions

View File

@@ -195,7 +195,8 @@ def register_query_tool_preferences(self):
{'label': '\'', 'value': '\''}],
control_props={
'allowClear': False,
'tags': False
'tags': False,
'creatable': True,
}
)
@@ -209,7 +210,8 @@ def register_query_tool_preferences(self):
{'label': gettext('Tab'), 'value': '\t'}],
control_props={
'allowClear': False,
'tags': False
'tags': False,
'creatable': True,
}
)

View File

@@ -147,6 +147,10 @@ class _Preference(object):
for opt in self.options:
if 'value' in opt and opt['value'] == res.value:
return True, res.value
if self.control_props and self.control_props['creatable']:
return True, res.value
if self.select and self.select['tags']:
return True, res.value
return True, self.default
@@ -191,7 +195,9 @@ class _Preference(object):
has_value = next((True for opt in self.options
if 'value' in opt and opt['value'] == value),
False)
assert (has_value or (self.select and self.select['tags']))
assert (has_value or (self.control_props and
(self.control_props['tags'] or
self.control_props['creatable'])))
elif self._type == 'date':
value = parser_map[self._type](value).date()
else: