diff --git a/release.sh b/release.sh index dd469f3a44633113154419b15da1cfb97f30a38a..a5f3654291743e5ac22fd3b938719e294b3a1e90 100755 --- a/release.sh +++ b/release.sh @@ -1,3 +1,4 @@ #!/bin/bash +rm -r dist/ build/ .eggs/ python setup.py sdist bdist_wheel python -m twine upload -s dist/* diff --git a/setup.py b/setup.py index 9e090d6eea97ff209dea886965a6303b865a2031..cfdf462ce4217dc6180c0b7af60a87f20e2003c7 100755 --- a/setup.py +++ b/setup.py @@ -49,7 +49,7 @@ MAJOR = 0 MINOR = 3 MICRO = 1 PRE = "" # e.g. rc0, alpha.1, 0.beta-23 -ISRELEASED = False +ISRELEASED = True if PRE: VERSION = "{}.{}.{}-{}".format(MAJOR, MINOR, MICRO, PRE) diff --git a/src/caosdb/common/models.py b/src/caosdb/common/models.py index 77638589d3ed4cd9dcb63c1935bcf1c2a34283ce..d5a56257020be27c0e3c95a02bebb846a7689c85 100644 --- a/src/caosdb/common/models.py +++ b/src/caosdb/common/models.py @@ -538,6 +538,14 @@ class Entity(object): return self.properties def get_property(self, key): + result = None + if hasattr(key, "name"): + result = self.get_property(key.name) + if result is None and hasattr(key, "id"): + result = self.get_property(key.id) + if result is not None: + return result + if isinstance(key, int): for p in self.properties: if p.id is not None and int(p.id) == int(key): diff --git a/unittests/test_property.py b/unittests/test_property.py index 76ebe8052fa8104992d6f31fc7f73a4065de1215..7d8d238edd59e47707f6e1ad831b0bb640cf0a6d 100644 --- a/unittests/test_property.py +++ b/unittests/test_property.py @@ -72,3 +72,13 @@ def test_list_of_references_with_null(): def test_role(): prop = Property() assert prop.role == "Property" + + +def test_get_property_with_entity(): + p = Property(name="Prop") + r = Record().add_property("Prop", "blub") + assert r.get_property(p).value == "blub" + + p = Property(id=1234) + r.add_property(id=1234, value="bla") + assert r.get_property(p).value == "bla"