Remove RefineProject.columns (not really used) and tidy up get_models().
This commit is contained in:
parent
10dfc41bcb
commit
d3b4a38574
|
@ -392,12 +392,12 @@ class RefineProject:
|
||||||
project_name or project_id)
|
project_name or project_id)
|
||||||
self.project_id = project_id
|
self.project_id = project_id
|
||||||
self.project_name = project_name
|
self.project_name = project_name
|
||||||
self.columns = [] # following filled in by get_models()
|
|
||||||
self.column_order = {} # order of column in UI
|
|
||||||
self.rows_response_factory = None
|
|
||||||
self.get_models()
|
|
||||||
self.engine = Engine()
|
self.engine = Engine()
|
||||||
self.sorting = Sorting()
|
self.sorting = Sorting()
|
||||||
|
# following filled in by get_models()
|
||||||
|
self.column_order = {} # order of column in UI
|
||||||
|
self.rows_response_factory = None # for parsing get_rows()
|
||||||
|
self.get_models()
|
||||||
|
|
||||||
def do_raw(self, command, data):
|
def do_raw(self, command, data):
|
||||||
"""Issue a command to the server & return a response object."""
|
"""Issue a command to the server & return a response object."""
|
||||||
|
@ -420,18 +420,15 @@ class RefineProject:
|
||||||
get_rows()."""
|
get_rows()."""
|
||||||
response = self.do_json('get-models', include_engine=False)
|
response = self.do_json('get-models', include_engine=False)
|
||||||
column_model = response['columnModel']
|
column_model = response['columnModel']
|
||||||
columns = column_model['columns']
|
|
||||||
# Pre-extend the list in python
|
|
||||||
self.columns = [None] * len(columns)
|
|
||||||
column_index = {}
|
column_index = {}
|
||||||
for i, column in enumerate(columns):
|
for i, column in enumerate(column_model['columns']):
|
||||||
cell_index, name = column['cellIndex'], column['name']
|
name = column['name']
|
||||||
self.column_order[name] = i
|
self.column_order[name] = i
|
||||||
column_index[name] = cell_index
|
column_index[name] = column['cellIndex']
|
||||||
self.columns[i] = name
|
|
||||||
self.key_column = column_model['keyColumnName']
|
self.key_column = column_model['keyColumnName']
|
||||||
self.rows_response_factory = RowsResponseFactory(column_index)
|
self.rows_response_factory = RowsResponseFactory(column_index)
|
||||||
# TODO: implement rest
|
# TODO: implement rest
|
||||||
|
return response
|
||||||
|
|
||||||
def wait_until_idle(self, polling_delay=0.5):
|
def wait_until_idle(self, polling_delay=0.5):
|
||||||
while True:
|
while True:
|
||||||
|
|
|
@ -81,8 +81,8 @@ class RefineTest(RefineTestCase):
|
||||||
|
|
||||||
def test_get_models(self):
|
def test_get_models(self):
|
||||||
self.assertEqual(self.project.key_column, 'email')
|
self.assertEqual(self.project.key_column, 'email')
|
||||||
self.assertTrue('email' in self.project.columns)
|
self.assertTrue('email' in self.project.column_order)
|
||||||
self.assertEqual(self.project.column_index['name'], 1)
|
self.assertEqual(self.project.column_order['name'], 1)
|
||||||
|
|
||||||
def test_delete_project(self):
|
def test_delete_project(self):
|
||||||
self.assertTrue(self.project.delete())
|
self.assertTrue(self.project.delete())
|
||||||
|
|
Loading…
Reference in New Issue