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

bugfix for controlled vocabulary, html table for openbis object

parent dd0d24da
No related branches found
No related tags found
No related merge requests found
...@@ -59,8 +59,9 @@ class PropertyHolder(): ...@@ -59,8 +59,9 @@ class PropertyHolder():
data_type = property_type['dataType'] data_type = property_type['dataType']
if data_type == 'CONTROLLEDVOCABULARY': if data_type == 'CONTROLLEDVOCABULARY':
voc = self._openbis.get_terms(name) voc = self._openbis.get_terms(name)
if value not in voc.terms: value = value.upper()
raise ValueError("Value must be one of these terms: " + ", ".join(voc.terms)) if value not in voc.df['code'].values:
raise ValueError("Value must be one of these terms: " + ", ".join(voc.df['code'].values))
elif data_type in ('INTEGER', 'BOOLEAN', 'VARCHAR'): elif data_type in ('INTEGER', 'BOOLEAN', 'VARCHAR'):
if not check_datatype(data_type, value): if not check_datatype(data_type, value):
raise ValueError("Value must be of type {}".format(data_type)) raise ValueError("Value must be of type {}".format(data_type))
......
...@@ -460,6 +460,7 @@ def _subcriteria_for_code(code, object_type): ...@@ -460,6 +460,7 @@ def _subcriteria_for_code(code, object_type):
return get_search_type_for_entity(object_type.lower()) return get_search_type_for_entity(object_type.lower())
class Openbis: class Openbis:
"""Interface for communicating with openBIS. """Interface for communicating with openBIS.
A recent version of openBIS is required (minimum 16.05.2). A recent version of openBIS is required (minimum 16.05.2).
...@@ -581,6 +582,31 @@ class Openbis: ...@@ -581,6 +582,31 @@ class Openbis:
'update_object(sampleId, space, project, experiment, parents, children, components, properties, tagIds, attachments)', # 'update_sample(sampleId, space, project, experiment, parents, children, components, properties, tagIds, attachments)' alias 'update_object(sampleId, space, project, experiment, parents, children, components, properties, tagIds, attachments)', # 'update_sample(sampleId, space, project, experiment, parents, children, components, properties, tagIds, attachments)' alias
] ]
def _repr_html_(self):
html = """
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th>attribute</th>
<th>value</th>
</tr>
</thead>
<tbody>
"""
attrs = ['url', 'port', 'hostname', 'verify_certificates', 'as_v3', 'as_v1', 'reg_v1', 'token']
for attr in attrs:
html += "<tr> <td>{}</td> <td>{}</td> </tr>".format(
attr, getattr(self, attr, '')
)
html += """
</tbody>
</table>
"""
return html
@property @property
def spaces(self): def spaces(self):
return self.get_spaces() return self.get_spaces()
......
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