<noscript>/<TransactionBenchmark> tags prevents reading Entity container
Since newer versions of the CaosDB server it is impossible to read xml containers which are the result of a server request directly into a db.Container.
The from_xml-method yields then:
src/newcrawler/identifiable_adapters.py:175: in restore_state
self._records = db.Container().from_xml(f.read())
../caosdb-pylib/src/caosdb/common/models.py:2709: in from_xml
c.append(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Entities/>
, entity = <noscript>
</noscript>
def append(self, entity):
"""Append an entity container.
If the parameter is an integer an entity with the corresponding ID is appended.
If the parameter is a string an entity with the corresponding name is appended.
Raise a TypeError if the entity is not a sub type of the correct class (as defined
via the constructor).
@param entity: The entity to be appended.
"""
if isinstance(entity, Entity):
super().append(entity)
elif isinstance(entity, int):
super().append(Entity(id=entity))
elif hasattr(entity, "encode"):
super().append(Entity(name=entity))
elif isinstance(entity, QueryTemplate):
super().append(entity)
else:
> raise TypeError(
"Entity was neither an id nor a name nor an entity." +
" (was " + str(type(entity)) + ")")
E TypeError: Entity was neither an id nor a name nor an entity. (was <class 'caosdb.common.models.Message'>)
../caosdb-pylib/src/caosdb/common/models.py:2581: TypeError
The problem is the <noscript>
tag at the beginning of the container. Same holds for <TransactionBenchmark/>
.
Workaround: Remove those two tags from the xml file and try again.