Use true/false instead of on/''. Update to new new-project params.

This commit is contained in:
Paul Makepeace 2013-10-14 00:28:50 +06:00
parent 717a03a838
commit ca25a305e0
1 changed files with 8 additions and 6 deletions

View File

@ -147,10 +147,11 @@ class Refine:
"""Open a Refine project.""" """Open a Refine project."""
return RefineProject(self.server, project_id) return RefineProject(self.server, project_id)
# These aren't used yet but are included for reference
new_project_defaults = { new_project_defaults = {
'text/line-based/*sv': { 'text/line-based/*sv': {
'encoding': '', 'encoding': '',
'separator': ",", 'separator': ',',
'ignore_lines': -1, 'ignore_lines': -1,
'header_lines': 1, 'header_lines': 1,
'skip_data_lines': 0, 'skip_data_lines': 0,
@ -226,7 +227,7 @@ class Refine:
def s(opt): def s(opt):
if isinstance(opt, bool): if isinstance(opt, bool):
return 'on' if opt else '' return 'true' if opt else 'false'
if opt is None: if opt is None:
return '' return ''
return str(opt) return str(opt)
@ -234,16 +235,17 @@ class Refine:
'format': project_format, 'format': project_format,
'encoding': s(encoding), 'encoding': s(encoding),
'separator': s(separator), 'separator': s(separator),
'ignore': s(ignore_lines), 'ignore-lines': s(ignore_lines),
'header-lines': s(header_lines), 'header-lines': s(header_lines),
'skip': s(skip_data_lines), 'limit': s(limit), 'skip-data-lines': s(skip_data_lines),
'guess-cell-value-types': s(guess_cell_value_types), 'limit': s(limit),
# don't know these: 'guess-value-type': s(guess_cell_value_types),
'process-quotes': s(process_quotes), 'process-quotes': s(process_quotes),
'store-blank-rows': s(store_blank_rows), 'store-blank-rows': s(store_blank_rows),
'store-blank-cells-as-nulls': s(store_blank_cells_as_nulls), 'store-blank-cells-as-nulls': s(store_blank_cells_as_nulls),
'include-file-sources': s(include_file_sources), 'include-file-sources': s(include_file_sources),
} }
if project_url is not None: if project_url is not None:
options['url'] = project_url options['url'] = project_url
elif project_file is not None: elif project_file is not None: