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

[utils] updated management/commands/install.py to create plotters with sample data

parent 28e1c027
No related branches found
No related tags found
1 merge request!222Plotterparams merge
Pipeline #
......@@ -678,6 +678,12 @@ def upload_plotter(prefix, name, data):
version=int(storage.version),
)
sample_data_file_location = prefix + "/plotters/" + name.split("/")[0] + "/" + \
name.split("/")[1] + "/sample_data.txt"
with open(sample_data_file_location) as sample_data_file:
sample_data = simplejson.load(sample_data_file)
if not plotter:
(plotter, errors) = Plotter.objects.create_plotter(
author=author,
......@@ -692,6 +698,8 @@ def upload_plotter(prefix, name, data):
logger.warn("Did not add plotter `%s', because: %s", name, errors)
return False
else:
plotter.sample_data = simplejson.dumps(sample_data, indent=4)
plotter.save()
logger.info("Added plotter `%s'", plotter)
else: #only updates documentation
......@@ -701,6 +709,7 @@ def upload_plotter(prefix, name, data):
plotter.declaration = declaration
plotter.description = description
plotter.code = code
plotter.sample_data = simplejson.dumps(sample_data, indent=4)
plotter.save()
logger.info("Updated plotter `%s'", plotter)
......
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