Skip to content
Snippets Groups Projects
Commit d3e673d7 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

WIP

parent be7f26b1
No related branches found
No related tags found
2 merge requests!71REL: RElease v0.2.0,!5FIX: use identifiable instead of record
This commit is part of merge request !5. Comments created here will be created in the context of that merge request.
......@@ -121,10 +121,6 @@ class IdentifiableAdapter(object):
"""
pass
@abstractmethod
def resolve_reference(self, record: db.Record):
pass
def get_identifiable(self, record: db.Record):
"""
retrieve the registred identifiable and fill the property values to create an
......@@ -223,8 +219,9 @@ class LocalStorageIdentifiableAdapter(IdentifiableAdapter):
with open(filename, "r") as f:
self._records = db.Container().from_xml(f.read())
# TODO: move to super class?
def is_identifiable_for_record(self, registered_identifiable: db.RecordType, record: db.Record):
def is_identifiable_for_record(self,
registered_identifiable: db.RecordType,
record: db.Record):
"""
Check whether this registered_identifiable is an identifiable for the record.
......@@ -301,22 +298,6 @@ class LocalStorageIdentifiableAdapter(IdentifiableAdapter):
return None
return candidates[0]
def resolve_reference(self, value: db.Record):
if self.get_registered_identifiable(value) is None:
raise NotImplementedError("Non-identifiable references cannot"
" be used as properties in identifiables.")
# TODO: just resolve the entity
value_identifiable = self.retrieve_identified_record(value)
if value_identifiable is None:
raise RuntimeError("The identifiable which is used as property"
" here has to be inserted first.")
if value_identifiable.id is None:
raise RuntimeError("The entity has not been assigned an ID.")
return value_identifiable.id
class CaosDBIdentifiableAdapter(IdentifiableAdapter):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment