Separate state handling from datagrid columns.
Review Request #5611 — Created March 11, 2014 and submitted — Latest diff uploaded
DataGrid column instances are shared across multiple instances of a
DataGrid. This would be fine, except we were storing important state on
the column instances, which preventing DataGrids from being reliable in
a multi-threaded configuration (such as Apache's mod_worker or mod_wsgi
daemon mode).DataGrid now creates wrappers around a Column, using the new
StatefulColumn class. These exist for the lifetime of a DataGrid
instance, and stores state about the associated column. It also wraps
all attribute and function access for the column, forwarding all
requests for attributes not otherwise stored on StatefulColumn.Column functions now all take a 'state' parameter, which StatefulColumn
will automatically pass when wrapping a function. This parameter is used
for any state-related access.A couple things were also cleaned up to help with this. Some work that
the Columns were doing (such as constructing Template objects on a
DataGrid) have been moved to the DataGrid.
Updated Review Board for these changes, and tested adding every column,
sorting many columns, and rearranging columns. Everything worked exactly
as it did before.Layouts were also properly saved and loaded.
Unit tests pass.