diff options
| author | Alon Levy <alon@pobox.com> | 2015-05-11 18:43:03 +0300 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-05-12 12:29:54 +0300 |
| commit | c3411e90e87712c625e5303b15351770e80cd865 (patch) | |
| tree | b1d0312d20c0fcf3eca42c3ededbeb2db236ab36 /src | |
| parent | ed332153735b915e978862e8342b13845ccaca78 (diff) | |
server/db_op/DBO_block_chain__commit: factor out _authored_by_statement
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/db_op.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/server/db_op.py b/src/server/db_op.py index 3b526029..b81bc288 100644 --- a/src/server/db_op.py +++ b/src/server/db_op.py @@ -254,15 +254,15 @@ class DBO_block_chain__commit(DB_op): self.l_id = l_id # create commit-[:__Authored-by]->__User link if possible - if None == ctx or None == ctx.user_name: - return + if None != ctx and None != ctx.user_name: + self.add_statement(self._authored_by_statement(ctx.user_name)) - q_arr = ['merge (n:%s {user_name: \'%s\'})' % (neo4j_schema.META_LABEL__USER, ctx.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), - ] - self.add_statement(q_arr) + def _authored_by_statement(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 process_result_set(self): """ |
