Commit 5a4a06a3 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

Merge branch 'fix_list_local_plotterparameter' into '1.4.x'

Fix local list for plotterparameters

See merge request !30
parents 62596fc4 7d26dd8a
Pipeline #20388 passed with stages
in 51 minutes and 7 seconds
......@@ -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')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment