From 59dc329c1e8346c00470fae3ab6a3e1c10e61312 Mon Sep 17 00:00:00 2001
From: davebshow <davebshow@gmail.com>
Date: Wed, 13 Jul 2016 11:11:39 -0400
Subject: [PATCH] simplified property db mapping access

---
 goblin/properties.py | 3 ++-
 tests/test_engine.py | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/goblin/properties.py b/goblin/properties.py
index 30430bf..dcf6029 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 f42aa31..714e843 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)
-- 
GitLab