models.py::_parse_value fails for some list-valued content
Summary
Somehow, sometimes _parse_value
fails, when it unexpectedly gets list-like content.
Expected Behavior
Should not fail.
Actual Behavior
In [17]: db.execute_query("FIND Record")
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-17-6030f7c12a1e> in <module>
----> 1 db.execute_query("FIND Record")
~/.local/lib/python3.9/site-packages/caosdb/common/models.py in execute_query(q, unique, raise_exception_on_error, cache, flags)
4055 query.flags = flags
4056
-> 4057 return query.execute(unique=unique,
4058 raise_exception_on_error=raise_exception_on_error,
4059 cache=cache)
~/.local/lib/python3.9/site-packages/caosdb/common/models.py in execute(self, unique, raise_exception_on_error, cache)
3992 entity_uri_segments=["Entity"],
3993 query_dict=query_dict)
-> 3994 cresp = Container._response_to_entities(http_response)
3995 self.results = cresp.query.results
3996 self.cached = cresp.query.cached
~/.local/lib/python3.9/site-packages/caosdb/common/models.py in _response_to_entities(http_response)
2726
2727 for child in xml:
-> 2728 e = _parse_single_xml_element(child)
2729
2730 if isinstance(e, Message):
~/.local/lib/python3.9/site-packages/caosdb/common/models.py in _parse_single_xml_element(elem)
4222 klass = classmap.get(elem.tag.lower())
4223 entity = klass()
-> 4224 Entity._from_xml(entity, elem)
4225
4226 return entity
~/.local/lib/python3.9/site-packages/caosdb/common/models.py in _from_xml(entity, elem)
999 for celem in elem:
1000
-> 1001 child = _parse_single_xml_element(celem)
1002
1003 if isinstance(child, Property):
~/.local/lib/python3.9/site-packages/caosdb/common/models.py in _parse_single_xml_element(elem)
4222 klass = classmap.get(elem.tag.lower())
4223 entity = klass()
-> 4224 Entity._from_xml(entity, elem)
4225
4226 return entity
~/.local/lib/python3.9/site-packages/caosdb/common/models.py in _from_xml(entity, elem)
1036
1037 try:
-> 1038 entity.value = value
1039 except ValueError:
1040 # circumvent the parsing.
~/.local/lib/python3.9/site-packages/caosdb/common/models.py in value(self, new_value)
222 @value.setter
223 def value(self, new_value):
--> 224 self.__value = _parse_value(self.datatype, new_value)
225
226 @property
~/.local/lib/python3.9/site-packages/caosdb/common/models.py in _parse_value(datatype, value)
1262 # for unversioned references
1263 try:
-> 1264 return int(value)
1265 except ValueError:
1266 # reference via name
TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'
Steps to Reproduce the Problem
TODO
Specifications
- Version: 0.6.0, 0.7.0 and 0.7.1.dev0+234bd386 all show this behaviour.
- Platform: Python 3.9 on Debian.
Possible fixes
- Handle lists?