diff --git a/src/caosdb/apiutils.py b/src/caosdb/apiutils.py index 37599d57c61be6d6209b410dcf238c5807a2995e..3af9345e48941d5f61766cc1c9d49a4a7b9c4fcb 100644 --- a/src/caosdb/apiutils.py +++ b/src/caosdb/apiutils.py @@ -86,11 +86,11 @@ def new_record(record_type, name=None, description=None, def id_query(ids): q = "FIND Entity with " + " OR ".join(["id={}".format(id) for id in ids]) - return db.execute_query(q) + return execute_query(q) def retrieve_entities_with_ids(entities): - collection = db.Container() + collection = Container() step = 20 for i in range(len(entities)//step+1): diff --git a/src/caosdb/common/datatype.py b/src/caosdb/common/datatype.py index f40b79f9819ea74461f8fcf7135f9baff69ac526..23b01a8a5db36e39d00e78f26c7de08a8bfb5f42 100644 --- a/src/caosdb/common/datatype.py +++ b/src/caosdb/common/datatype.py @@ -43,7 +43,7 @@ def LIST(datatype): def get_list_datatype(datatype): """ returns the datatype of the elements in the list """ - match = re.match("LIST(<|<)(?P<datatype>.*)(>|>)", "LISTING") + match = re.match("LIST(<|<)(?P<datatype>.*)(>|>)", datatype) if match is not None: return match.group("datatype") @@ -109,7 +109,7 @@ def get_id_of_datatype(datatype): raise AmbiguityException( "Name {} did not lead to unique result; Missing " "implementation".format(datatype)) - elif len(res) == 1: + elif len(res) != 1: raise EntityDoesNotExistError( "No RecordType named {}".format(datatype)) diff --git a/src/caosdb/common/models.py b/src/caosdb/common/models.py index f9d4f2b07b075eda7d50394c4f95a113f815a5bf..32343680f1ffc8a3b2eb53302c10e67101cc93f6 100644 --- a/src/caosdb/common/models.py +++ b/src/caosdb/common/models.py @@ -38,8 +38,8 @@ from sys import hexversion from tempfile import NamedTemporaryFile from warnings import warn -from lxml import etree -from .datatype import is_reference +from caosdb.common.datatype import (BOOLEAN, DATETIME, DOUBLE, FILE, INTEGER, + LIST, REFERENCE, TEXT, is_reference) from caosdb.common.utils import uuid, xml2str from caosdb.configuration import get_config from caosdb.connection.connection import get_connection @@ -50,8 +50,9 @@ from caosdb.exceptions import (AmbiguityException, AuthorizationException, EntityHasNoDatatypeError, TransactionError, UniqueNamesError, UnqualifiedParentsError, UnqualifiedPropertiesError, URITooLongException) -from caosdb.common.datatype import (BOOLEAN, DATETIME, DOUBLE, FILE, INTEGER, - LIST, REFERENCE, TEXT, is_reference) +from lxml import etree + +from .datatype import is_reference _ENTITY_URI_SEGMENT = "Entity" @@ -953,7 +954,8 @@ class Entity(object): if isinstance(prop.value, list): prop.value = [func(el) for el in prop.value] else: - prop.value = func(prop.value) + if prop.value is not None: + prop.value = func(prop.value) def _parse_col_values(cdt, vals):