Skip to content

Commit

Permalink
skip fields which are empty in CFG file #210
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Feb 7, 2020
1 parent b0d005f commit 24361d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions forms/table_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ def to_json(self):
else:
raise Exception('InputType "{}" not implemented'.format(input_type))

if layer_data[key] == '':
layer_data.pop(key)

if export_legacy_single_row:
if self.definitions.key() == 'atlas':
layer_data['atlasEnabled'] = 'True'
Expand Down
4 changes: 2 additions & 2 deletions test/test_table_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def test_tool_tip(self):
table_manager.from_json(json)
self.assertEqual(table_manager.table.rowCount(), 1)
data = table_manager.to_json()
json['lines'].pop('colorGeom')
self.assertDictEqual(data, json)

def test_attribute_table(self):
Expand Down Expand Up @@ -152,7 +153,7 @@ def test_locate_by_layer(self):
},
'lines_2': {
'fieldName': 'name',
# 'filterFieldName': 'id', DISABLED on purpore. This field is not compulsory.
# 'filterFieldName': 'id', DISABLED on purpose. This field is not compulsory.
'displayGeom': 'False',
'minLength': 0,
'filterOnLocate': 'True',
Expand Down Expand Up @@ -195,7 +196,6 @@ def test_locate_by_layer(self):
expected = {
'lines_2': {
'fieldName': 'name',
'filterFieldName': '',
'displayGeom': 'False',
'minLength': 0,
'filterOnLocate': 'True',
Expand Down

0 comments on commit 24361d6

Please sign in to comment.