Repository: tinkerpop
Updated Branches:
  refs/heads/master 65e8edb38 -> a98fb132e


Fix the serializers lookup to handle the type first, then the class inheritance.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/1af9ba6f
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/1af9ba6f
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/1af9ba6f

Branch: refs/heads/master
Commit: 1af9ba6fe24f5425d8f18ab4d34ea536fd91e77e
Parents: c958b22
Author: Alan Boudreault <a...@alanb.ca>
Authored: Fri Jan 27 08:43:35 2017 -0500
Committer: Alan Boudreault <a...@alanb.ca>
Committed: Fri Jan 27 09:14:38 2017 -0500

----------------------------------------------------------------------
 .../main/jython/gremlin_python/structure/io/graphson.py   | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1af9ba6f/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
----------------------------------------------------------------------
diff --git 
a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py 
b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
index 85e161d..31d9d65 100644
--- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
+++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
@@ -75,9 +75,13 @@ class GraphSONWriter(object):
         """
         Encodes python objects in GraphSON type-tagged dict values
         """
-        for key, serializer in self.serializers.items():
-            if isinstance(obj, key):
-                return serializer.dictify(obj, self)
+        try:
+            return self.serializers[type(obj)].dictify(obj, self)
+        except KeyError:
+            for key, serializer in self.serializers.items():
+                if isinstance(obj, key):
+                    return serializer.dictify(obj, self)
+
         # list and map are treated as normal json objs (could be isolated 
serializers)
         if isinstance(obj, (list, set)):
             return [self.toDict(o) for o in obj]

Reply via email to