Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion csvwlib/converter/ModelConverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ def _normalize_column_names(self):
for i, column in enumerate(table['tableSchema']['columns'], start=1):
if 'name' not in column:
language = JSONLDUtils.language(self.metadata['@context'], table)
titles = column['titles'] if type(column['titles']) is list else [column['titles']]
titles = column.get('titles',[])
if type(titles) is not list:
titles = [titles]
if language is None:
column['name'] = DOPUtils.natural_language_first_value(titles)
else:
Expand Down
2 changes: 1 addition & 1 deletion csvwlib/utils/DOPUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ def natural_language_first_value(property_value):
if type(property_value) is str:
return property_value
elif type(property_value) is list:
return property_value[0]
return next(iter(property_value or []), None)