diff --git a/src/caosdb/high_level_api.py b/src/caosdb/high_level_api.py index 66e07a62b19dac0293f104cf433c6ee55cb9cb4f..f323589402656e21bf9a9bfd12bcabc8c7f8a906 100644 --- a/src/caosdb/high_level_api.py +++ b/src/caosdb/high_level_api.py @@ -111,8 +111,6 @@ class CaosDBPythonUnresolvedReference(CaosDBPythonUnresolved): class CaosDBPythonEntity(object): - _last_id = 0 - def __init__(self): """ Initialize a new CaosDBPythonEntity for the high level python api. @@ -146,6 +144,10 @@ class CaosDBPythonEntity(object): # which must not be changed by the set_property function. self._forbidden = dir(self) + ["_forbidden"] + def use_parameter(self, name, value): + self.__setattr__(name, value) + return value + @property def id(self): """ @@ -224,17 +226,6 @@ class CaosDBPythonEntity(object): def version(self, val: str): self._version = val - # @staticmethod - # def _get_new_id(): - # """ - # Get a new negative ID for a CaosDB Entity. - - # The first ID is -1 and decremented with each call of this function. - # """ - # CaosDBPythonEntity._last_id -= 1 - - # return CaosDBPythonEntity._last_id - def _set_property_from_entity(self, ent: db.Entity, importance: str, references: Optional[db.Container]): """ @@ -709,6 +700,8 @@ def _single_convert_to_python_object(robj: CaosDBPythonEntity, for base_attribute in BASE_ATTRIBUTES: val = entity.__getattribute__(base_attribute) if val is not None: + if isinstance(val, db.common.models.Version): + val = val.id robj.__setattr__(base_attribute, val) for prop in entity.properties: