Skip to content
Snippets Groups Projects
Commit 2f216cef authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

FIX: problem in old apiutils sub function with recursion variable

parent 8f983393
No related branches found
No related tags found
No related merge requests found
Pipeline #19588 passed
......@@ -381,7 +381,10 @@ def _single_convert_to_python_object(robj, entity):
return robj
def _single_convert_to_entity(entity, robj, **kwargs):
def _single_convert_to_entity(entity, robj, recursive_depth, **kwargs):
"""
recursive_depth: disabled if 0
"""
if robj._id is not None:
entity.id = robj._id
......@@ -407,16 +410,16 @@ def _single_convert_to_entity(entity, robj, **kwargs):
else:
entity.add_parent(id=parent)
def add_property(entity, prop, name, recursive=False, datatype=None):
def add_property(entity, prop, name, _recursive=False, datatype=None):
if datatype is None:
raise ArgumentError("datatype must not be None")
raise RuntimeError("Datatype must not be None.")
if isinstance(prop, CaosDBPythonEntity):
entity.add_property(name=name, value=str(
prop._id), datatype=datatype)
if recursive and not prop.do_not_expand:
return convert_to_entity(prop, recursive=recursive)
if _recursive and not prop.do_not_expand:
return convert_to_entity(prop, recursive=_recursive)
else:
return []
else:
......@@ -426,6 +429,11 @@ def _single_convert_to_entity(entity, robj, **kwargs):
return []
if recursive_depth == 0:
recursive = False
else:
recursive = True
for prop in robj._properties:
value = robj.__getattribute__(prop)
......@@ -439,7 +447,7 @@ def _single_convert_to_entity(entity, robj, **kwargs):
if recursive and not v.do_not_expand:
children.append(convert_to_entity(
v, recursive=recursive))
v, recursive=recursive_depth-1))
else:
if isinstance(v, float) or isinstance(v, int):
lst.append(str(v))
......
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