Chromium Code Reviews| Index: gm/rebaseline_server/column.py |
| diff --git a/gm/rebaseline_server/column.py b/gm/rebaseline_server/column.py |
| index d8d119d1304f74b43c35c5e865863f7d1ccef958..eb58b81bc21a0c5a4be0f2cf1aa9ed0dbef5b30a 100644 |
| --- a/gm/rebaseline_server/column.py |
| +++ b/gm/rebaseline_server/column.py |
| @@ -9,13 +9,17 @@ found in the LICENSE file. |
| ColumnHeaderFactory class (see class docstring for details) |
| """ |
| +import utils |
| + |
| # Keys used within dictionary representation of each column header. |
| # NOTE: Keep these in sync with static/constants.js |
| -KEY__HEADER_TEXT = 'headerText' |
| -KEY__HEADER_URL = 'headerUrl' |
| -KEY__IS_FILTERABLE = 'isFilterable' |
| -KEY__IS_SORTABLE = 'isSortable' |
| -KEY__VALUES_AND_COUNTS = 'valuesAndCounts' |
| +KEY__EXTRACOLUMNHEADERS = 'extraColumnHeaders' |
| +KEY__EXTRACOLUMNHEADERS__COUNTS = 'counts' |
|
epoger
2014/05/07 21:26:17
While I was at it, renamed these particular key co
|
| +KEY__EXTRACOLUMNHEADERS__HEADER_TEXT = 'headerText' |
| +KEY__EXTRACOLUMNHEADERS__HEADER_URL = 'headerUrl' |
| +KEY__EXTRACOLUMNHEADERS__IS_FILTERABLE = 'isFilterable' |
| +KEY__EXTRACOLUMNHEADERS__IS_SORTABLE = 'isSortable' |
| +KEY__EXTRACOLUMNHEADERS__VALUES = 'values' |
| class ColumnHeaderFactory(object): |
| @@ -46,7 +50,8 @@ class ColumnHeaderFactory(object): |
| """Creates the header for this column, in dictionary form. |
| Creates the header for this column in dictionary form, as needed when |
| - constructing the JSON representation. Uses the KEY__* constants as keys. |
| + constructing the JSON representation. Uses the KEY__EXTRACOLUMNHEADERS__* |
| + constants as keys. |
| Args: |
| values_and_counts_dict: dictionary mapping each possible column value |
| @@ -54,12 +59,14 @@ class ColumnHeaderFactory(object): |
| None if this information is not available. |
| """ |
| asdict = { |
| - KEY__HEADER_TEXT: self._header_text, |
| - KEY__IS_FILTERABLE: self._is_filterable, |
| - KEY__IS_SORTABLE: self._is_sortable, |
| + KEY__EXTRACOLUMNHEADERS__HEADER_TEXT: self._header_text, |
| + KEY__EXTRACOLUMNHEADERS__IS_FILTERABLE: self._is_filterable, |
| + KEY__EXTRACOLUMNHEADERS__IS_SORTABLE: self._is_sortable, |
| } |
| if self._header_url: |
| - asdict[KEY__HEADER_URL] = self._header_url |
| + asdict[KEY__EXTRACOLUMNHEADERS__HEADER_URL] = self._header_url |
| if self._include_values_and_counts and values_and_counts_dict: |
| - asdict[KEY__VALUES_AND_COUNTS] = values_and_counts_dict |
| + values, counts = utils.unzip_dict(values_and_counts_dict) |
| + asdict[KEY__EXTRACOLUMNHEADERS__VALUES] = values |
| + asdict[KEY__EXTRACOLUMNHEADERS__COUNTS] = counts |
| return asdict |