Skip to content
Snippets Groups Projects
Commit 53e6471d authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

Merge branch 'dev' into f-exception-handling

parents 01484027 fb85f4b6
No related branches found
No related tags found
No related merge requests found
......@@ -244,6 +244,8 @@ class CaosDBPythonEntity(object):
return (val, False)
elif pr[0:4] == "LIST":
return self._type_converted_list(val, pr)
elif isinstance(val, Entity):
return (convert_to_python_object(val), False)
else:
return (int(val), True)
......
......@@ -3887,6 +3887,8 @@ def _parse_single_xml_element(elem):
elif elem.tag.lower() == "value":
if len(elem) == 1 and elem[0].tag.lower() == "emptystring":
return ""
elif len(elem) == 1 and elem[0].tag.lower() in classmap:
return _parse_single_xml_element(elem[0])
elif elem.text is None or elem.text.strip() == "":
return None
......
......@@ -84,3 +84,8 @@ def test_get_property_with_entity():
p = Property(id=1234)
r.add_property(id=1234, value="bla")
assert r.get_property(p).value == "bla"
def test_selected_reference_list():
assert len(testrecord.get_property("Conductor").value) == 1
assert isinstance(testrecord.get_property("Conductor").value[0], Entity)
......@@ -328,4 +328,10 @@
<Value>45531</Value>
<Value>45532</Value>
</Property>
<Property datatype="LIST&lt;Person&gt;" description="DESCRIBE ME!" id="1634561234" importance="FIX" name="Conductor">
<Value>
<Record id="23456543">
</Record>
</Value>
</Property>
</Record>
......@@ -24,7 +24,6 @@
"""Tests for caosdb.common.utils."""
from __future__ import unicode_literals
from lxml.etree import Element
from nose.tools import assert_equals as eq
from caosdb.common.utils import xml2str
......@@ -32,4 +31,4 @@ def test_xml2str():
name = 'Björn'
element = Element(name)
serialized = xml2str(element)
eq(serialized, "<Björn/>\n")
assert serialized == "<Björn/>\n"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment