Skip to content
Snippets Groups Projects
Commit 2b08f7af authored by Swen Vermeul's avatar Swen Vermeul
Browse files

check attributes for new DataSets

parent 4b7680a8
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ from threading import Thread ...@@ -3,6 +3,7 @@ from threading import Thread
from tabulate import tabulate from tabulate import tabulate
from queue import Queue from queue import Queue
from .openbis_object import OpenBisObject from .openbis_object import OpenBisObject
from .definitions import openbis_definitions
from .utils import VERBOSE from .utils import VERBOSE
import requests import requests
import json import json
...@@ -11,6 +12,7 @@ from pandas import DataFrame ...@@ -11,6 +12,7 @@ from pandas import DataFrame
import urllib.parse import urllib.parse
# for Data upload # for Data upload
PYBIS_PLUGIN = "dataset-uploader-api" PYBIS_PLUGIN = "dataset-uploader-api"
dataset_definitions = openbis_definitions('DataSet')
class DataSet(OpenBisObject): class DataSet(OpenBisObject):
...@@ -21,6 +23,10 @@ class DataSet(OpenBisObject): ...@@ -21,6 +23,10 @@ class DataSet(OpenBisObject):
if kwargs is None: if kwargs is None:
kwargs = {} kwargs = {}
else:
for key in kwargs:
if key not in dataset_definitions['attrs_new']:
raise ValueError("{} is not a valid attribute for a DataSet".format(key))
if kwargs.get('code'): if kwargs.get('code'):
kwargs["autoGeneratedCode"] = False kwargs["autoGeneratedCode"] = False
...@@ -106,6 +112,7 @@ class DataSet(OpenBisObject): ...@@ -106,6 +112,7 @@ class DataSet(OpenBisObject):
'set_parents()', 'set_children()', 'set_components()', 'set_contained()', 'set_containers()', 'set_parents()', 'set_children()', 'set_components()', 'set_contained()', 'set_containers()',
'sample', 'sample',
'experiment', 'experiment',
'collection',
'dataStore', 'dataStore',
'physicalData', 'physicalData',
'linkedData', 'linkedData',
......
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