diff options
| author | LV-426 <lv-426@taproot.org.il> | 2015-05-12 20:03:27 +0300 |
|---|---|---|
| committer | LV-426 <lv-426@taproot.org.il> | 2015-05-12 20:03:27 +0300 |
| commit | fd2b65d265b3e2d25a8649d89d7fce3befb6ad0c (patch) | |
| tree | e1837ec5b79799ebc33585a7ce79cdd72799a0c6 /src/server/db_op.py | |
| parent | d44209f43bcb0e315d3449fc37e5aa08f9c0f1fb (diff) | |
db_op: DBO_block_chain__commit: use _add_statement__ prefix
Diffstat (limited to 'src/server/db_op.py')
| -rw-r--r-- | src/server/db_op.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/server/db_op.py b/src/server/db_op.py index 9c1fd756..1bea8bf7 100644 --- a/src/server/db_op.py +++ b/src/server/db_op.py @@ -263,27 +263,27 @@ class DBO_block_chain__commit(DB_op): # create commit-[:__Authored-by]->__User link if possible if None != ctx and None != ctx.user_name: - self.add_statement(self._authored_by_statement(ctx.user_name)) + self.add_statement(self._add_statement__authored_by(ctx.user_name)) if None != meta and 'sentence' in meta and meta['sentence'] != '': - self.add_statement(self._result_of_sentence(ctx.user_name, meta['sentence'])) + self.add_statement(self._add_statement__result_of_sentence(ctx.user_name, meta['sentence'])) - def _result_of_sentence(self, user_name, sentence): - return ['match (head:%s:%s)' % (neo4j_schema.META_LABEL__VC_HEAD, - neo4j_schema.META_LABEL__VC_COMMIT), - 'create (head)-[r:%s]->(result_of:%s {sentence: \'%s\'} )' % ( - neo4j_schema.META_LABEL__VC_COMMIT_RESULT_OF, - neo4j_schema.META_LABEL__VC_OPERATION, - sentence, - )] - - def _authored_by_statement(self, user_name): + def _add_statement__authored_by(self, user_name): return ['merge (n:%s {user_name: \'%s\'})' % (neo4j_schema.META_LABEL__USER, user_name), 'with n', 'match (m:%s)' % (neo4j_schema.META_LABEL__VC_HEAD), # FIXME: specify commit-label index 'create (m)-[r:`%s`]->(n)' % (neo4j_schema.META_LABEL__VC_COMMIT_AUTHOR), ] + def _add_statement__result_of_sentence(self, user_name, sentence): + return ['match (head:%s:%s)' % (neo4j_schema.META_LABEL__VC_HEAD, + neo4j_schema.META_LABEL__VC_COMMIT), + 'create (head)-[r:%s]->(result_of:%s {sentence: \'%s\'} )' % ( + neo4j_schema.META_LABEL__VC_COMMIT_RESULT_OF, + neo4j_schema.META_LABEL__VC_OPERATION, + sentence, + )] + def process_result_set(self): """ @return: a Topo_Diff object consisting of the commit node and parent link @@ -811,7 +811,7 @@ class DBO_rzdoc__commit_log(DB_op): neo4j_schema.META_LABEL__VC_COMMIT_AUTHOR, neo4j_schema.META_LABEL__USER, ), - 'return collect([c, o, u])'] # since o is optional we need to pair them + 'return collect([c, o, u])'] # since o is optional we need to pair them db_q = DB_Query(q_arr) self.add_db_query(db_q) @@ -830,7 +830,7 @@ class DBO_rzdoc__commit_log(DB_op): diff = obj_from_blob(commit['blob']) diff['meta'] = dict( ts_created=commit['ts_created'], - author = 'Anonymous' if user is None else user['user_name'], + author='Anonymous' if user is None else user['user_name'], commit=commit['hash'], ) if None is not operation and 'sentence' in operation: |
