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

MAINT: some refactorings

parent e1078ff7
No related branches found
No related tags found
2 merge requests!57RELEASE 0.7.3,!52F refactor high level api
......@@ -270,6 +270,21 @@ class CaosDBPythonRecordType(CaosDBPythonEntity):
class CaosDBPythonProperty(CaosDBPythonEntity):
pass
class CaosDBPythonParent(object):
"""
Parents can be either given by name or by ID.
When resolved, both fields should be set.
"""
def __init__(self, id=None, name=None):
self.id = id
self.name = name
class CaosDBPythonUnresolvedReference(object):
def __init__(self, id=None):
self.id = id
class CaosDBPythonFile(CaosDBPythonEntity):
def get_File(self, target=None):
......@@ -311,16 +326,10 @@ def _single_convert_to_entity(entity, robj, recursive_depth, **kwargs):
children = []
for parent in robj._parents:
if sys.version_info[0] < 3:
if hasattr(parent, "encode"):
entity.add_parent(name=parent)
else:
entity.add_parent(id=parent)
if hasattr(parent, "encode"):
entity.add_parent(name=parent)
else:
if hasattr(parent, "encode"):
entity.add_parent(name=parent)
else:
entity.add_parent(id=parent)
entity.add_parent(id=parent)
def add_property(entity, prop, name, _recursive=False, datatype=None):
if datatype is None:
......
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