You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2016/08/24 21:28:15 UTC

tinkerpop git commit: found a bug I introduced where if the result set is empty a type cast issue happens. fixed.

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1278 5fcc9224f -> 952c1c741


found a bug I introduced where if the result set is empty a type cast issue happens. fixed.


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

Branch: refs/heads/TINKERPOP-1278
Commit: 952c1c7419ee13460c296cfe2527142de31ea71e
Parents: 5fcc922
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Aug 24 15:28:11 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Aug 24 15:28:11 2016 -0600

----------------------------------------------------------------------
 .../gremlin_python/driver/driver_remote_connection.py  | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/952c1c74/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py b/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
index 271d245..58342a2 100644
--- a/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
@@ -81,22 +81,23 @@ class DriverRemoteConnection(RemoteConnection):
             msg = yield resp.receive()
             if msg is None:
                 break
+            # on first message, get the right result data structure
             if None == results:
-                aggregateTo = msg[0]
-                if "list" == aggregateTo:
+                if "list" == msg[0]:
                     results = []
-                elif "set" == aggregateTo:
+                elif "set" == msg[0]:
                     results = set()
-                elif "map" == aggregateTo:
+                elif "map" == msg[0]:
                     results = {}
                 else:
                     results = []
+            # updating a map is different than a list or a set
             if isinstance(results, dict):
                 for item in msg[1]:
                     results.update(item)
             else:
                 results += msg[1]
-        raise gen.Return(results)
+        raise gen.Return([] if None == results else results)
 
     def close(self):
         self._ws.close()
@@ -193,7 +194,7 @@ class Response:
         data = message["result"]["data"]
         msg = message["status"]["message"]
         meta = message["result"]["meta"]
-        aggregateTo = None if "aggregateTo" not in meta else meta["aggregateTo"]
+        aggregateTo = "list" if "aggregateTo" not in meta else meta["aggregateTo"]
 
         if status_code == 407:
             self._authenticate(self._username, self._password, self._processor)