Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
fix wrt #299
Browse files Browse the repository at this point in the history
  • Loading branch information
forman committed Jul 20, 2017
1 parent 33ce3f8 commit 1f68b9e
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions cate/webapi/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
from cate.conf.defaults import GLOBAL_CONF_FILE, WEBAPI_USE_WORKSPACE_IMAGERY_CACHE
from cate.core.ds import DATA_STORE_REGISTRY, get_data_stores_path, find_data_sources
from cate.core.op import OP_REGISTRY
from cate.core.wsmanag import WorkspaceManager
from cate.core.workspace import OpKwArgs
from cate.core.wsmanag import WorkspaceManager
from cate.util import Monitor, cwd


Expand Down Expand Up @@ -105,12 +105,9 @@ def get_data_stores(self) -> list:
:return: JSON-serializable list of data stores, sorted by name.
"""
data_stores = DATA_STORE_REGISTRY.get_data_stores()
data_store_list = []
for data_store in data_stores:
data_store_list.append(dict(id=data_store.id, title=data_store.title))

return sorted(data_store_list, key=lambda ds: ds['name'])
data_stores = sorted(DATA_STORE_REGISTRY.get_data_stores(), key=lambda ds: ds.title or ds.id)
return [dict(id=data_store.id,
title=data_store.title) for data_store in data_stores]

def get_data_sources(self, data_store_id: str, monitor: Monitor) -> list:
"""
Expand All @@ -123,15 +120,10 @@ def get_data_sources(self, data_store_id: str, monitor: Monitor) -> list:
data_store = DATA_STORE_REGISTRY.get_data_store(data_store_id)
if data_store is None:
raise ValueError('Unknown data store: "%s"' % data_store_id)

data_sources = data_store.query(monitor=monitor)
data_source_list = []
for data_source in data_sources:
data_source_list.append(dict(id=data_source.id,
title=data_source.title,
meta_info=data_source.meta_info))

return sorted(data_source_list, key=lambda ds: ds['name'])
data_sources = sorted(data_store.query(monitor=monitor), key=lambda ds: ds.title or ds.id)
return [dict(id=data_source.id,
title=data_source.title,
meta_info=data_source.meta_info) for data_source in data_sources]

def get_ds_temporal_coverage(self, data_store_id: str, data_source_id: str, monitor: Monitor) -> dict:
"""
Expand Down

0 comments on commit 1f68b9e

Please sign in to comment.