diff --git a/pybis/src/python/pybis/openbis_object.py b/pybis/src/python/pybis/openbis_object.py index 6a905cb88512db0780566f268b7ed435bcb32624..8d1a43b3c5b026d42f819ec8b6715fe9dd26d158 100644 --- a/pybis/src/python/pybis/openbis_object.py +++ b/pybis/src/python/pybis/openbis_object.py @@ -1,6 +1,7 @@ from .property import PropertyHolder from .attribute import AttrHolder from .utils import VERBOSE +from .definitions import get_definition_for_entity class OpenBisObject(): @@ -36,6 +37,14 @@ class OpenBisObject(): for key in kwargs: setattr(self, key, kwargs[key]) + def __dir__(self): + defs = get_definition_for_entity(self.entity) + if self.is_new: + return defs['attrs_new'] + else: + return defs['attrs'] + + def _set_data(self, data): # assign the attribute data to self.a by calling it # (invoking the AttrHolder.__call__ function)