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

ENH: it is now possible to deserialize records using the high level api...

ENH: it is now possible to deserialize records using the high level api without giving parents or metadata
parent 5d81222a
No related branches found
No related tags found
1 merge request!107ENH: add entity getters and cached functions
Pipeline #37347 passed
...@@ -629,6 +629,7 @@ class CaosDBPythonEntity(object): ...@@ -629,6 +629,7 @@ class CaosDBPythonEntity(object):
else: else:
entity = CaosDBPythonRecord() entity = CaosDBPythonRecord()
if "parents" in serialization:
for parent in serialization["parents"]: for parent in serialization["parents"]:
if "unresolved" in parent: if "unresolved" in parent:
id = None id = None
...@@ -640,7 +641,8 @@ class CaosDBPythonEntity(object): ...@@ -640,7 +641,8 @@ class CaosDBPythonEntity(object):
entity.add_parent(CaosDBPythonUnresolvedParent( entity.add_parent(CaosDBPythonUnresolvedParent(
id=id, name=name)) id=id, name=name))
else: else:
raise NotImplementedError() raise NotImplementedError(
"Currently, only unresolved parents can be deserialized.")
for baseprop in ("name", "id", "description", "version"): for baseprop in ("name", "id", "description", "version"):
if baseprop in serialization: if baseprop in serialization:
...@@ -673,7 +675,8 @@ class CaosDBPythonEntity(object): ...@@ -673,7 +675,8 @@ class CaosDBPythonEntity(object):
if f.name in metadata: if f.name in metadata:
propmeta.__setattr__(f.name, metadata[f.name]) propmeta.__setattr__(f.name, metadata[f.name])
else: else:
raise NotImplementedError() pass
# raise NotImplementedError()
return entity return entity
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment