diff --git a/goblin/properties.py b/goblin/properties.py index 30430bfdebffae5f0e51052718771e013c7766d3..dcf60296bbf17dbabf00d41f32533113cca53dff 100644 --- a/goblin/properties.py +++ b/goblin/properties.py @@ -11,13 +11,14 @@ class PropertyDescriptor: as instance attributes.""" def __init__(self, name, prop): + self._prop_name = name self._name = '_' + name self._data_type = prop.data_type self._default = prop.default def __get__(self, obj, objtype): if obj is None: - return self._data_type + return getattr(objtype.__mapping__, self._prop_name) return getattr(obj, self._name, self._default) def __set__(self, obj, val): diff --git a/tests/test_engine.py b/tests/test_engine.py index f42aa311ed373ed64ec1d9b5549bde6bc47c7ce3..714e843cec56ec77bdb97a72c1a136ff82bbeed0 100644 --- a/tests/test_engine.py +++ b/tests/test_engine.py @@ -232,11 +232,11 @@ class TestEngine(unittest.TestCase): session.add(leif, jon, works_for) await session.flush() result = await session.traversal(TestVertex).has( - TestVertex.__mapping__.name, ('v1', 'the one and only leifur'))._in().all() + TestVertex.name, ('v1', 'the one and only leifur'))._in().all() async for msg in result: self.assertIs(msg, jon) result = await session.traversal(TestVertex).has( - TestVertex.__mapping__.name, ('v1', 'the one and only jonathan')).out().all() + TestVertex.name, ('v1', 'the one and only jonathan')).out().all() async for msg in result: self.assertIs(msg, leif) await session.remove_vertex(leif)