From 779c2d5f05b6c08c4a3d60e88259660b00e336dd Mon Sep 17 00:00:00 2001 From: Andras Gefferth Date: Tue, 2 Apr 2013 15:48:31 +0200 Subject: [PATCH 1/2] Added custom_step function --- bulbs/element.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bulbs/element.py b/bulbs/element.py index 5d474eb..31f0873 100644 --- a/bulbs/element.py +++ b/bulbs/element.py @@ -342,6 +342,17 @@ def map(self): log.debug("This is deprecated; use data() instead.") return self.data() + def custom_step(self,script,params={}): + """ + Execute a custom gremlin step starting from the current element. + Do not use "_id" as a key in params. + e.g.: >>> node.custom_step('outE(x).bothV',{'x':'A'}) + """ + full_script = 'g.v(_id).'+script + params['_id']=self._id + resp = self._client.gremlin(full_script,params) + return initialize_elements(self._client,resp) + # From 8482b431e42b17de5b6ad326c32db2feaa79338d Mon Sep 17 00:00:00 2001 From: Andras Gefferth Date: Tue, 2 Apr 2013 16:01:08 +0200 Subject: [PATCH 2/2] fixed tab --- bulbs/element.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bulbs/element.py b/bulbs/element.py index 31f0873..5e41931 100644 --- a/bulbs/element.py +++ b/bulbs/element.py @@ -346,7 +346,7 @@ def custom_step(self,script,params={}): """ Execute a custom gremlin step starting from the current element. Do not use "_id" as a key in params. - e.g.: >>> node.custom_step('outE(x).bothV',{'x':'A'}) + e.g.: >>> node.custom_step('outE(x).bothV',{'x':'A'}) """ full_script = 'g.v(_id).'+script params['_id']=self._id