Skip to content
Snippets Groups Projects
Commit 7d26dd8a authored by Flavio TARSETTI's avatar Flavio TARSETTI
Browse files

[common] patch local list for plotterparameter

parent 62596fc4
No related branches found
No related tags found
2 merge requests!541.4.x,!30Fix local list for plotterparameters
Pipeline #
......@@ -50,6 +50,7 @@ from beat.core import algorithm
from beat.core import toolchain
from beat.core import experiment
from beat.backend.python import utils
TYPE_GLOB = {
'dataformat': os.path.join('*', '*', '*.json'),
......@@ -393,6 +394,13 @@ def make_up_local_list(prefix, type, requirements):
'''
root = os.path.join(prefix, TYPE_PLURAL[type])
if type in NOSTORAGE:
try:
root = os.path.join(prefix, TYPE_NOSTORAGE[type])
except:
logger.error("Selected type is not valid: %s"%type)
return 1
l = glob.glob(os.path.join(root, TYPE_GLOB[type]))
candidates = [os.path.splitext(os.path.relpath(o, root))[0] for o in l]
......@@ -449,8 +457,15 @@ def display_local_list(prefix, type):
for name in names:
logger.info("%s", name)
try:
storage = TYPE_STORAGE[type](prefix, name)
contents = simplejson.loads(storage.json.load(), object_pairs_hook=collections.OrderedDict)
contents = None
if type in NOSTORAGE:
name_path = os.path.join(prefix, TYPE_NOSTORAGE[type], name)
data_json = utils.File(name_path + '.json')
with open(data_json.path, 'rt') as f:
contents = simplejson.load(f, object_pairs_hook=collections.OrderedDict)
else:
storage = TYPE_STORAGE[type](prefix, name)
contents = simplejson.loads(storage.json.load(), object_pairs_hook=collections.OrderedDict)
if 'description' in contents:
logger.extra(2*' ' + contents['description'])
except simplejson.JSONDecodeError:
......@@ -778,7 +793,6 @@ def pull(webapi, prefix, type, names, fields, force, indentation):
status += 1 #error
continue
from beat.backend.python import utils
if 'data' in fields:
name_path = os.path.join(prefix, TYPE_NOSTORAGE[type], name)
data_json = utils.File(name_path + '.json')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment