diff options
| author | LV-426 <lv-426@taproot.org.il> | 2014-10-12 15:17:17 +0200 |
|---|---|---|
| committer | LV-426 <lv-426@taproot.org.il> | 2014-10-12 15:17:17 +0200 |
| commit | 8e20a72f5cd0464f673a374e5a3741a58932e770 (patch) | |
| tree | c1c6d759d4bff90b91df9bdcd0bce7ca8f7c0945 /src-py/neo4j_util.py | |
| parent | 6a5c1acbeca40a374736d657d48beb33f0d32b27 (diff) | |
return DB_result_set when iterating over DB_op results
Diffstat (limited to 'src-py/neo4j_util.py')
| -rw-r--r-- | src-py/neo4j_util.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src-py/neo4j_util.py b/src-py/neo4j_util.py index 6b78dc18..7c228dea 100644 --- a/src-py/neo4j_util.py +++ b/src-py/neo4j_util.py @@ -7,6 +7,17 @@ import urllib2 import model import string +class DB_result_set(object): + def __init__(self, data): + self.data = data + + def __iter__(self): + for db_row_dict in self.data['data']: + # example: dict: {u'row': [{u'title': u'foo'}]} + assert None != db_row_dict['row'][0] + + yield db_row_dict['row'][0] + class Cypher_String_Formatter(string.Formatter): """ Despite parameter support in Cypher, we sometimes do engage in query string building |
